编译器警告(等级 2)CS0467
更新:2007 年 11 月
错误消息
方法“method”和非方法“non-method”之间存在多义性。正在使用方法组。
如果继承的成员具有相同的签名,但来自不同的接口,则会导致多义性错误。
示例
下面的示例生成 CS0467。
// CS0467.cs
interface IList
{
int Count { get; set; }
}
interface ICounter
{
void Count(int i);
}
interface IListCounter : IList, ICounter {}
class Driver
{
void Test(IListCounter x)
{
x.Count = 1;
x.Count(1); // CS0467
// To resolve change the method name "Count" to another name.
}
static void Main()
{
}
}