【发布时间】:2011-01-03 21:01:37
【问题描述】:
我有一堂课:
public class class1
{
public string Property1 {get;set;}
public int Property2 {get;set;}
}
将被实例化:
var c = new class1();
c.Property1 = "blah";
c.Property2 = 666;
所以请耐心等待(我是泛型新手),我需要另一个具有泛型类型属性的类,以便使用 Property1 或 Property2 来设置 Property3:
public class Class2
{
public GenericType Property3 {get;set;}
}
我希望能够:
var c2 = new class2();
c2.Property3 = c1.Property2 // Any property of any type.
【问题讨论】: