【发布时间】:2011-09-06 10:23:19
【问题描述】:
有两种对象:
public class Toto
{
String test1 = "";
int test2 = 0;
}
public class Titi
{
String testA = "";
int testB = 0;
}
我将创建一个允许我动态检查任何对象内容的方法。例如:
public void checkDatas(Object o)
在这个方法中,我会访问 test1 并检查它的值,然后是 test2,然后是 testA,最后是 testB。像这样的东西 (Object) Object.getMember(new Toto(), "test1")
我在反射过程中找到了一些解释,但没有任何作用。
有人有想法吗?
提前致谢。
【问题讨论】:
-
请提供实际问题,这样会更容易帮助您。
标签: c# .net reflection dynamic .net-4.0