Compiler Warning (Level 1) CS1957
Member 'name' overrides 'method'. There are multiple override candidates at run-time. It is implementation dependent which method will be called.
Method parameters that vary only by whether they are ref
or out
cannot be differentiated at run-time.
- Give one of the methods a different name or different number of parameters.
The following code generates CS1957:
// cs1957.cs
class Base<T, S>
{
public virtual string Test(out T x) // CS1957
{
x = default(T);
return "Base.Test";
}
public virtual void Test(ref S x) { }
}
class Derived : Base<int, int>
{
public override string Test(out int x)
{
x = 0;
return "Derived.Test";
}
static int Main()
{
int x;
if (new Derived().Test(out x) == "Derived.Test")
return 0;
return 1;
}
}
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.
.NET feedback
.NET is an open source project. Select a link to provide feedback: