Home How to get and set values of properties using reflection
 I want to get the properties of my class which looks like this: public class Model { public Content Intro { get; set; } public List Intro2 { get; set; } public Content Intro3 { get; set; } public List Intro4 { get; set; } }  After getting the properties, I want to set their values to be decoded. So, for example, Content has properties of title, description etc, I want each to be html decoded, as well as product has some properties which need to be decoded. What I have done so far:  foreach (var v in homePage.GetType().GetProperties()) { foreach (var p in v.PropertyType.GetProperties()) { // if(p.Name.Contains("title") { // // it will be html encoded, i want to use WebUtility.HtmlDecode(property); // } // also, I want to iterate through each element of the list (if it's a list property) } }