Hi!
Does anyone know if objects are returned byval, or byref in c#?
i.e.
or
I'm trying to devise a way of keeping a collection of objects that are references to object instances elsewhere in an application.
e.g. If you create a foo object, then as part of the creation process the instance would be added to a 'loaded objects table'.
However, these objects are created using factory methods which return instances (as above).
If methods return instance copies, then i guess i could store a fooData object in the table & have any foo object refer to these, but that's just another layer of complexity that would be best to avoid.
Thanks!
Does anyone know if objects are returned byval, or byref in c#?
i.e.
Code:
foo refToNewObj = FactoryClass.CreateAndAddToTable();
Code:
foo copyOfNewObj = FactoryClass.CreateAndAddToTable();
I'm trying to devise a way of keeping a collection of objects that are references to object instances elsewhere in an application.
e.g. If you create a foo object, then as part of the creation process the instance would be added to a 'loaded objects table'.
However, these objects are created using factory methods which return instances (as above).
If methods return instance copies, then i guess i could store a fooData object in the table & have any foo object refer to these, but that's just another layer of complexity that would be best to avoid.
Thanks!