Set object property using reflection

Is there a way in C# where I can use reflection to set an object property?

Ex:

MyObject obj = new MyObject();
obj.Name = "Value";

I want to set obj.Name with reflection. Something like:

Reflection.SetProperty(obj, "Name") = "Value";

Is there a way of doing this?

10 Answers
10

Leave a Comment