我有一个扩展方法,比如
public static class Extension
{
public static string GetTLD(this string str)
{
var host = new System.Uri(str).Host;
int index = host.LastIndexOf('.'), last = 3;
while (index >= last - 3)
{
last = index;
index = host.LastIndexOf('.', last - 1);
}
var domain = host.Substring(index + 1);
return domain;
}
}
我把这叫做
string domain = "." + _url.GetTLD();
我在建造和清洁建造方面没有错误
以下方法或属性之间的调用不明确: ‘myIGNOU.Extension.GetTLD(String)’和 ‘myIGNOU.Extension.GetTLD(String)’
我发誓我没有把这个扩展方法放在项目的其他地方.
但如果我删除了这个方法,那么我在构建时,而不是在运行时,会得到错误.没有这个方法的代码,一切都正常.