C# Error CS8141 – The tuple element names in the signature of method ‘{0}’ must match the tuple element names of interface method ‘{1}’ (including on the return type).

C# Error

CS8141 – The tuple element names in the signature of method ‘{0}’ must match the tuple element names of interface method ‘{1}’ (including on the return type).

Reason for the Error & Solution

The tuple element names in the signature of method must match the tuple element names of interface method (including on the return type).

Example

The following sample generates CS8141:

// CS8141.cs (10,27)
using System.Collections;

public interface IGrabber<out T>
{
    T GetOne();
}

class SomeGrabber : IGrabber<(int, int)>
{
    public (int a, int b) GetOne()
    {
        return (1, 2);
    }
}

To correct this error

Changing the signature of the GetOne method to return an unnamed tuple, matching the unnamed tuple in the interface, will correct this error:

    public (int, int) GetOne()
    {
        return (1, 2);
    }