C# Error CS1739 – The best overload for ‘{0}’ does not have a parameter named ‘{1}’

C# Error

CS1739 – The best overload for ‘{0}’ does not have a parameter named ‘{1}’

Reason for the Error & Solution

The best overload for does not have a parameter named

Example

The following sample generates CS1739:

// CS1739.cs (11,31)
using System;

public class A
{
    public int this[Range range] => 42;
}
public class C
{
    public static void Main()
    {
        Console.Write(new A()[param: 1..^1]);
    }
}

To correct this error

Use the name of the parameter as it is declared in the member to correct this error.

    public static void Main()
    {
        Console.Write(new A()[range: 1..^1]);
    }

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

C# Compiler Error CS0442 – ‘Property’: abstract properties cannot have private accessors Reason for the Error You’ll get this error...
This is a really simple one . Below is a simple example of an enum called “Designation” defined with the...
This blog post explain the usage of the Checked Block in .NET and how you can use them in Visual...