为什么在实现接口时,如果我将方法设为公开,我不必显式指定接口,但如果我将其设为私有,我必须......像这样(GetQueryString
是 IBar 的方法):
public class Foo : IBar
{
//This doesn't compile
string GetQueryString()
{
///...
}
//But this does:
string IBar.GetQueryString()
{
///...
}
}
那么,为什么在方法设为私有时必须显式指定接口,而不是在方法设为公开时?