I’m trying to use reflection for some reason and I got into this problem.
class Service
{
public int ID {get; set;}
.
.
.
}
class CustomService
{
public Service srv {get; set;}
.
.
.
}
//main code
Type type = Type.GetType(typeof(CustomService).ToString());
PropertyInfo pinf = type.GetProperty("Service.ID"); // returns null
My problem is that I want to get a propery inside another property of the main object.
Is there a simple way to this goal?
Thanks in Advance.
You have to reflect on the custom service and find the property value. After that you have to reflect on that property and find its value. Like so: