Compiler Error CS1501
Visual Studio 2010
No overload for method 'method' takes 'number' arguments
A call was made to a class method, but there is no form of the method that takes the necessary number of arguments.
The following sample generates CS1501.
using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { ExampleClass ec = new ExampleClass(); ec.ExampleMethod(); ec.ExampleMethod(10); // The following line causes compiler error CS1501 because // ExampleClass does not contain an ExampleMethod that takes // two arguments. ec.ExampleMethod(10, 20); } } // ExampleClass defines two methods, one that has no parameters and // one that has a single parameter. class ExampleClass { public void ExampleMethod() { Console.WriteLine("Zero parameters"); } public void ExampleMethod(int i) { Console.WriteLine("One integer parameter."); } } }
Default parameters in C#
Since C# version 4.0, parameters with default values exist in C#, so the description ought to be updated. /JeppeSN
Edit by SJ at MSFT: You're right. I will update it. Thanks.
Edit by SJ at MSFT: You're right. I will update it. Thanks.
- 9/20/2011
- JeppeSN1
- 10/3/2011
- SJ_at_MSFT