草庐IT

PrintProperties

全部标签

c# - 递归获取类的属性和子属性

我在做类似RecursivelyGetProperties&ChildPropertiesOfAnObject的事情,但我想递归地使用反射来获取每个属性。我从RecursivelyPrinttheproperties得到了代码.代码的问题是:它只向下一层,我想知道你如何使用反射自动获取所有属性?我刚刚编写了以下示例容器代码:publicclassContainer{publicBottleMyBottle{get;set;}publicListAddresses{get;set;}publicContainer(){Addressa=newAddress();a.AddressLine

c# - 递归获取类的属性和子属性

我在做类似RecursivelyGetProperties&ChildPropertiesOfAnObject的事情,但我想递归地使用反射来获取每个属性。我从RecursivelyPrinttheproperties得到了代码.代码的问题是:它只向下一层,我想知道你如何使用反射自动获取所有属性?我刚刚编写了以下示例容器代码:publicclassContainer{publicBottleMyBottle{get;set;}publicListAddresses{get;set;}publicContainer(){Addressa=newAddress();a.AddressLine