我在vs2010中使用dot42。我尝试获取一个类的字段列表。我在字段列表中有0个元素。
dot42是否支持反射?
任何例子或帮助都将不胜感激。
诚挚的问候
发布于 2014-07-24 07:48:11
下面是我正在做的一个例子:
public class Class1
{
public int publicInt;
private string privateString;
public string Value { get; set; }
public void Method1()
{
throw new NotImplementedException();
}
}我有一个带有泛型方法的anthor类:
public class Class2
{
public void GenericMethod<T>() where T : new()
{
Type entityType = typeof(T);
//Here, i want to get the FieldInfo list of T.
//typeof(T) does not work also.
}
}在MainActivity中,当我单击一个按钮时,我会看到:
Class2 c2 = new Class2();
c2.GenericMethod<Class1>();https://stackoverflow.com/questions/24919266
复制相似问题