Declaring a Generic with Multiple Type Parameters : Generic Interface « Generic « C# / CSharp Tutorial






interface IPair<TFirst, TSecond>
{
    TFirst First
    { get; set;    }
    TSecond Second
    { get; set;    }
}

public struct Pair<TFirst, TSecond>: IPair<TFirst, TSecond>
{
    public Pair(TFirst first, TSecond second)
    {
        _First = first;
        _Second = second;
    }

    public TFirst First
    {
        get{ return _First;    }
        set{ _First = value; }
    }
    private TFirst _First;

    public TSecond Second
    {
        get{ return _Second; }
        set{ _Second = value; }
    }
    private TSecond _Second;
}








18.17.Generic Interface
18.17.1.Generic Interface
18.17.2.Implement multiple generic interfaces by a non-generic class
18.17.3.Generic IEquatable
18.17.4.Declaring a Generic Interface, Implementing a Generic Interface
18.17.5.Declaring a Generic with Multiple Type Parameters
18.17.6.Generic Interface for binary operation