我有这样的课程:(我简化了课程以便解释)
public class CRecherche
{
bool m_TestA;
bool m_TestB;
bool m_TestC;
public CRecherche()
{
}
public myFonction()
{
bool bValue = (bool)typeof(CRecherche).GetProperty("m_Test"+"A").GetValue(this,null);
}
}
我想使用该名称阅读 m_TestA、m_TestB 和 m_TestC。
我努力了 :
(bool)typeof(CRecherche).GetProperty("m_Test"+"A").GetValue(this,null);
但是没有成功。
有人有想法吗?
非常感谢,