C# 模板变量和可存储模板变量的变量
有两个变量C# 模板变量和可存储模板变量的变量,c#,templates,types,C#,Templates,Types,有两个变量 basic<type1> type_1; basic<type2> type_2; 我想用这两个变量来存储另一个这样的变量 basic<type1> type_1; basic<type2> type_2; var type = type_1 or type_2 // What type of variable should be declared? 谢谢。您可以使用对象或动态 另外,如果basic继承自basic,您将能够使
basic<type1> type_1;
basic<type2> type_2;
我想用这两个变量来存储另一个这样的变量
basic<type1> type_1;
basic<type2> type_2;
var type = type_1 or type_2 // What type of variable should be declared?
谢谢。您可以使用对象或动态
另外,如果basic继承自basic,您将能够使用basic作为变量类型。您能否澄清您的问题?正确,但不完整。。。实际上,任何基类都可以,例如对于basic:root1:root2:root3,除了对象之外,您还可以使用所有rootX