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]);
}