The call is ambiguous between single method i.e extension method

前端 未结 6 935
悲&欢浪女
悲&欢浪女 2021-02-12 04:06

I have an extension method like

public static class Extension
{
    public static string GetTLD(this string str)
    {
        var host = new System.Uri(str).Hos         


        
6条回答
  •  长发绾君心
    2021-02-12 04:28

    I had the same situation. I had a custom grid control for which there was an extension method. The method was only declared in one place. The control had been in use in multiple places throughout my solution with no problems. Then one day, I copied a control that implemented the custom grid control by literally copying and pasting within the same project. Then I just renamed the properties as appropriate. After that the solution wouldn't build quoting the same error as above. I suspect the copy and paste added to the project a reference to itself.

    Deleting it resolved the problem.

提交回复
热议问题