I know how to get property Name:
Person pers = new Person();
var prop = pers.GetType().GetProperty("Name");
How to get property Salary from class Person using Reflection?
public class Person
{
public string Name {get; set;}
public Job PlaceOfWork {get; set;}
}
public class Job
{
public string Position {get; set;}
public decimal Salary {get; set;}
}
Aucun commentaire:
Enregistrer un commentaire