我正在尋找一種Tuple屬性可以接收幾個元組的方式,如Tuple<int>
,Tuple<string>
。下面的代碼是,我試圖做一個例子:是否可以推廣Tuple屬性?
public class A
{
public virtual Tuple Condition
{
get;
set;
}
}
public class B: A
{
public override Tuple<int, string> Condition
{
get;
set;
}
}
我想使用條件屬性從A類,並用它在其他類,如B和ASIGN它的一個具體的元組。
B b = new B();
B.Condition = Tuple.Create(2, "Bella");
A a = b;
a.Condition // Here must show B.Condition
將元組暴露爲API的一部分很少是一個好主意。你真的想要建模什麼? –