how do I iterate through internal properties in c#

前端 未结 6 1152
鱼传尺愫
鱼传尺愫 2020-12-30 23:07
public class TestClass
{
        public string property1 { get; set; }
        public string property2 { get; set; }

        internal string property3 { get; set; }         


        
6条回答
  •  独厮守ぢ
    2020-12-30 23:47

    by specifying what bindingflags in GetProperties:

    foreach (PropertyInfo property in typeof(TestClass).GetProperties(
          BindingFlags.Instance|
          BindingFlags.Public|
          BindingFlags.NonPublic))
    

提交回复
热议问题