【发布时间】:2016-05-10 23:21:12
【问题描述】:
假设我有这样的课程:
public class TestClass <T>
{
public T Prop { get; set; }
}
我试图确定属性类型是T,而不是传递的实际类型,例如int
为了更清楚一点:
TestClass<int> tc=new TestClass<int>();
tc.GetType().GetProperty("prop").PropertyType.Name; //this returns int, but I need "T"
【问题讨论】:
标签: c# reflection properties