public class TestClass
{
public string property1 { get; set; }
public string property2 { get; set; }
internal string property3 { get; set; }
internal string property4 { get; set; }
internal string property5 { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我可以使用以下循环遍历属性,但它只显示公共属性.我需要所有的属性.
foreach (PropertyInfo property in typeof(TestClass).GetProperties())
{
//do something
}
Run Code Online (Sandbox Code Playgroud)