Yes, you can use reflection - just select its Type.GetProperty (specifying anchor flags if necessary), then call SetValue accordingly. Example:
using System; class Person { public string Name { get; set; } } class Test { static void Main(string[] arg) { Person p = new Person(); var property = typeof(Person).GetProperty("Name"); property.SetValue(p, "Jon", null); Console.WriteLine(p.Name);
If this is not a public property, you need to specify BindingFlags.NonPublic | BindingFlags.Instance BindingFlags.NonPublic | BindingFlags.Instance in a GetProperty call.
Jon Skeet Oct 10 '11 at 9:19
source share