Creating Object and setting properties using reflection
suggest changeLets say we have a class Classy that has property Propertua
public class Classy
{
public string Propertua {get; set;}
}
to set Propertua using reflection:
var typeOfClassy = typeof (Classy);
var classy = new Classy();
var prop = typeOfClassy.GetProperty("Propertua");
prop.SetValue(classy, "Value");
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents