Is it safe to change from structure to class
.net, vb.net
Solution
Is this only about where the object will be stored (stack or heap) or application behavior may be broken?
This is one concern. One more significant concern should be about the difference in the semantics between a value type and a reference type. Do you want when you assign a value of your object to assign a copy of this object or a copy of the reference, which points to an object in the heap? This could be a big issue. Why I say so? Wherever you pass your object, if you make it a class, you will pass a reference and any change that will be made on at least one of it's fields would be reflected to the object you passed and not to a copy of the object you passed. This may be an issue or not. However, in order you give a concrete answer, you have to run though your code base and look there thoroughly how your object is used. Only after doing this, you be in a position to give the right answer.
Problem
We have a structure which is widely used throughout the whole application (over one hundred times). The structure has become too complex and I'm thinking about remaking it to class. Is it safe to migrate from structure to class? Is this only about where the object will be stored (stack or heap) or application behavior may be broken?