How to read properties of a class property in a class.

  • Thread starter Thread starter Arun Balakrishnan (Azure)
  • Start date Start date
A

Arun Balakrishnan (Azure)

Guest
Hi,

I have two classes Class1 and Class2. Class2 has included as property in Class1.


public class Class1

{

public string EmpName { get; set; }



public string LastName { get; set; }



public string Designation { get; set; }


[SubModelAttribute]

public Class2 Details { get; set; }


}


public class Class2

{



public decimal Salary { get; set; }

public DateTime CreatedDate { get; set; }

public string CharColumn { get; set; }


}


I can read all properties in Class1 by using below code.



Class1 obj = new Class1();

Var prop = obj.GetType().GetProperties();



But I want to read all properties of Class2 from Class1.






Thanks in advance

Continue reading...
 
Back
Top