Expand To Show Full Article
C# Error CS8140 - '{0}' is already listed in the interface list on type '{2}' with different tuple element names, as '{1}'. - Developer Publish

C# Error CS8140 – ‘{0}’ is already listed in the interface list on type ‘{2}’ with different tuple element names, as ‘{1}’.

C# Error

CS8140 – ‘{0}’ is already listed in the interface list on type ‘{2}’ with different tuple element names, as ‘{1}’.

Reason for the Error & Solution

is already listed in the interface list on type with different tuple element names, as.

Example

The following sample generates CS8140:

// CS8140.cs (11,7)

interface I<T>
{
    T GetValue();
}

interface I2 : I<(int c, int d)>
{
}

class C : I<(int a, int b)>, I2
{
    public (int c, int d) GetValue()
    {
        return (1, 2);
    }
}

To correct this error

Renaming the tuple element names to match the interface declaration corrects this error:

interface I<T>
{
    T GetValue();
}

interface I2 : I<(int c, int d)>
{
}

class C : I<(int c, int d)>, I2
{
    public (int c, int d) GetValue()
    {
        return (1, 2);
    }
}