Compiler Warning (level 2) CS0467
Ambiguity between method 'method' and non-method 'non-method'. Using method group.
Inherited members from different interfaces that have the same signature cause an ambiguity error.
Example
The following example generates 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)
{
// The following line causes the warning. The assignment also
// causes an error because you can't assign a value to a method.
x.Count = 1;
x.Count(3);
// To resolve the warning, you can change the name of the method or
// the property.
// You can also disambiguate by specifying IList or ICounter.
((IList)x).Count = 1;
((ICounter)x).Count(3);
}
static void Main()
{
}
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for