.NET Framework Creating Object and setting properties using reflection


Example

Lets 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");