C# 自定义组元扩展类(Tuple)
组元Tuple没有构造函数,自定义一个有构造函数的组元TupleEx。
namespace TupleEx { public class TupleEx<T1> { /// <summary> /// 元素1 /// </summary> public T1 Item1 { get; set; } } public class TupleEx<T1, T2> { /// <summary> /// 元素1 /// </summary> public T1 Item1 { get; set; } /// <summary> /// 元素2 /// </summary> public T2 Item2 { get; set; } } public class TupleEx<T1, T2, T3> { /// <summary> /// 元素1 /// </summary> public T1 Item1 { get; set; } /// <summary> /// 元素2 /// </summary> public T2 Item2 { get; set; } /// <summary> /// 元素3 /// </summary> public T3 Item3 { get; set; } } public class TupleEx<T1, T2, T3,T4> { /// <summary> /// 元素1 /// </summary> public T1 Item1 { get; set; } /// <summary> /// 元素2 /// </summary> public T2 Item2 { get; set; } /// <summary> /// 元素3 /// </summary> public T3 Item3 { get; set; } /// <summary> /// 元素4 /// </summary> public T4 Item4 { get; set; } } public class TupleEx<T1, T2, T3, T4,T5> { /// <summary> /// 元素1 /// </summary> public T1 Item1 { get; set; } /// <summary> /// 元素2 /// </summary> public T2 Item2 { get; set; } /// <summary> /// 元素3 /// </summary> public T3 Item3 { get; set; } /// <summary> /// 元素4 /// </summary> public T4 Item4 { get; set; } /// <summary> /// 元素5 /// </summary> public T5 Item5 { get; set; } } public class TupleEx<T1, T2, T3, T4, T5, T6> { /// <summary> /// 元素1 /// </summary> public T1 Item1 { get; set; } /// <summary> /// 元素2 /// </summary> public T2 Item2 { get; set; } /// <summary> /// 元素3 /// </summary> public T3 Item3 { get; set; } /// <summary> /// 元素4 /// </summary> public T4 Item4 { get; set; } /// <summary> /// 元素5 /// </summary> public T5 Item5 { get; set; } /// <summary> /// 元素6 /// </summary> public T6 Item6 { get; set; } } public class TupleEx<T1, T2, T3, T4, T5, T6, T7> { /// <summary> /// 元素1 /// </summary> public T1 Item1 { get; set; } /// <summary> /// 元素2 /// </summary> public T2 Item2 { get; set; } /// <summary> /// 元素3 /// </summary> public T3 Item3 { get; set; } /// <summary> /// 元素4 /// </summary> public T4 Item4 { get; set; } /// <summary> /// 元素5 /// </summary> public T5 Item5 { get; set; } /// <summary> /// 元素6 /// </summary> public T6 Item6 { get; set; } /// <summary> /// 元素7 /// </summary> public T7 Item7 { get; set; } } public class TupleEx<T1, T2, T3, T4, T5, T6, T7, T8> { /// <summary> /// 元素1 /// </summary> public T1 Item1 { get; set; } /// <summary> /// 元素2 /// </summary> public T2 Item2 { get; set; } /// <summary> /// 元素3 /// </summary> public T3 Item3 { get; set; } /// <summary> /// 元素4 /// </summary> public T4 Item4 { get; set; } /// <summary> /// 元素5 /// </summary> public T5 Item5 { get; set; } /// <summary> /// 元素6 /// </summary> public T6 Item6 { get; set; } /// <summary> /// 元素7 /// </summary> public T7 Item7 { get; set; } /// <summary> /// 元素8 /// </summary> public T8 Item8 { get; set; } } }