怎么走?我不想使用不同名称的函数。
public class DataRowSafe
{
public String Get(String Column)
{
return String.Empty;
}
public int Get(String Column)
{
return 0;
}
}
DataRowSafe r=new DataRowSafe();
String res=r.Get("Column1");
int res2=r.Get("Column2");//<--- Ambiguous call
最佳答案
方法的重载要求您的名称相似的方法必须具有不同的签名。返回值微不足道!在这里查看this教程。
关于c# - 类中的模糊调用函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15760497/