G
Guest
When I create an object in VB.NET I define both properties (data) and methods
(code). If I have 1,000 instances of this object stored in a Dictionary as
Dictionary(of int32, object) then I am obviously repeating the data of the
object 1,000 times.
If I understand correctly how objects are constructed, the methods (code) is
only stored once in memory and referenced by each instance of the object.
Thus it does not matter how many methods I have in an object when it comes to
efficiency and memory usage.
When is it a best practice to keep the object "lightweight" (with minimal
code)? Is this the case when we are remoting objects? Are there other reasons
to keep objects that are in collections "lightweight"?
(code). If I have 1,000 instances of this object stored in a Dictionary as
Dictionary(of int32, object) then I am obviously repeating the data of the
object 1,000 times.
If I understand correctly how objects are constructed, the methods (code) is
only stored once in memory and referenced by each instance of the object.
Thus it does not matter how many methods I have in an object when it comes to
efficiency and memory usage.
When is it a best practice to keep the object "lightweight" (with minimal
code)? Is this the case when we are remoting objects? Are there other reasons
to keep objects that are in collections "lightweight"?