This is because struct are value types, such as primitives ( int , short , etc.). When you insert a struct into an object , it makes a copy of itself, which works separately. Here is a simple example to illustrate this.
Point a = new Point(); Console.WriteLine(a);
class vs struct
If you want to use a reference type, you will not run into this problem, and your program will simply pass a link to your single object. Use class not struct if you want a reference type.
internal class Point : IChangeBoxedPoint
When to use struct
According to this other question which refers to MSDN .
Do not define the structure if the type has all of the following characteristics:
- It logically represents a single value similar to primitive types (integer, double, etc.).
- It has an instance size less than 16 bytes.
- It is unchanging.
- It does not need to be inserted into the box often.
If you do not know immutable means, the object cannot change. That way, you actually go against good practice by boxing a struct in an interface in an attempt to modify them.
Boxing at IChangeBoxedPoint
You can get around your problem with List<IChangeBoxedPoint> , but that just changes it to use a reference to your value type, so my question is why are you worried when you can just change your struct to class .
List<IChangeBoxedPoint> a = new List<IChangeBoxedPoint>();
Further reading
source share