2010-03-02 95 views

回答

4
public class VPair<TFirst, TSecond> 
    { 
     public TFirst First { get; set; } 
     public TSecond Second { get; set; } 

     public VPair(TFirst first, TSecond second) 
     { 
      First = first; 
      Second = second; 
     } 
    } 

或C#4.0

奖金 Tuple类:

public class VTriple<TFirst, TSecond, TThird> : VPair<TFirst, TSecond> 
    { 
     public TThird Third { get; set; } 

     public VTriple(TFirst first, TSecond second, TThird third) 
      : base(first, second) 
     { 
      Third = third; 
     } 
    } 
5

不可以。不过,您可以使用数组或地图来返回它们。

+1

+1 - 在问题中排除了最健全的解决方案! – Fenton 2010-03-15 08:16:22

0

您可以返回一个列表<对象>。

相关问题