Equivalent of Tuple (.NET 4) for .NET Framework 3.5

后端 未结 6 1889
我在风中等你
我在风中等你 2020-11-29 04:05

Is there a class existing in .NET Framework 3.5 that would be equivalent to the .NET 4 Tuple?

I would like to use it in order to return several values from a method,

6条回答
  •  余生分开走
    2020-11-29 04:53

    Yes, you can just use Tuple.cs from mono:

    You require the dependencies as well:
    Tuples.cs
    IStructuralComparable.cs
    IStructuralEquatable.cs

    You just put a

    #define NET_4_0
    

    in front of every

    #if NET_4_0
    

    and there you go, a feature-complete implementation of System.Tuple for .NET 2.0.

提交回复
热议问题