I have an instance of a class, I want to change an object data member of this instance only with another object of the same type (swap), due to my system c
If you use .NET 3.5, you can use my open-source library, Fasterflect, to address that with the following code:
typeof(MyType).SetField("MyField", anotherObject);
When using Fasterflect, you don't have to bother with the right BindingFlags specification and the performance implication (as when using reflection).