Hi,
I'm looking for an efficient way to get all properties/ fields of complex type which internally have Properties of another complex type.
- class A
- {
- public int Id{get;set;}
- public string Name{get;set;}
- public List<string> Branch{get;set;}
- public BuildData build {get;set;}
- public SampleData sample {get;set;}
- public DummyData dData {get;set}
-
- public A(){}
- }
-
- class BuildData{
- private string _buildData;
- public string param1{get;set;}
- public string[] paramArgs{get;set;}
- }
- class SampleData {
- public string Test{get;set;}
- public List<DummyData> dummyArgs{get;set;}
- }
-
- class DummyData {
- public int Val{get;set;}
- public string GUIData{get;set;}
- }
I have to use class A & get all its members (fields, Props) which should also include members of other complex types such as DummyData, BuildData, SampleData.
I tried using Reflection but couldn't get all members. Followed this article (https://www.c-sharpcorner.com/UploadFile/ff2f08/deep-copy-of-object-in-C-Sharp/) - but couldn't achieve it.