c#reflection获取其公共名称的私有属性的名称

时间:2013-11-26 19:28:10

标签: c# reflection system.reflection

我帮助反思,按照下面的代码解释我的需要,在foreach中我希望按名称获取公共私人名称

class Test
{
   private string _test;

   public string Test
    {
        get { return _test; }
        set { _test= value; }
    }
}

foreach (PropertyInfo Prop in new Test().GetType().GetProperties())
{
       Prop.Name = Name Public = Test
       I Want Private Name = _test
       How to do?
}

0 个答案:

没有答案