I
Ian
I am looking at porting code from a C++ application to C#. This requires
implementing data sharing functionality similar to what is provided by a
smart pointer in C++. I have only recently begun to work in C# and am
asking for suggestions/comments of how to implement a similar data sharing
technique in C#.
A C++ smart pointer can be used to share common information. For example,
assume information managed by objects I1, I2, I3, ... Im are to be processed
by objects P1, P2, P3, ... Pn. The total information contained by the 'Im'
objects is considerable and it is not possible for each of the 'Pn' objects
to phsyically duplicate the information contained in each of the 'Im'
objects. However, if each of the 'Im' objects is a smart (i.e. referenced
counted) pointer, then it is very easy for each 'Pn' object to get a
reference to all of the 'Im' objects. As such, P1 can then process and
delete it's copy of the 'Im' objects independently of when the other 'Pn-1'
objects process and delete their 'Im' objects.
My understanding is that the use of pointers in C# is strongly discouraged.
The question then is there any other way for C# to implement data sharing
functionality similar to that provided by smart pointers in C++?
Thank you to all who respond,
Ian
implementing data sharing functionality similar to what is provided by a
smart pointer in C++. I have only recently begun to work in C# and am
asking for suggestions/comments of how to implement a similar data sharing
technique in C#.
A C++ smart pointer can be used to share common information. For example,
assume information managed by objects I1, I2, I3, ... Im are to be processed
by objects P1, P2, P3, ... Pn. The total information contained by the 'Im'
objects is considerable and it is not possible for each of the 'Pn' objects
to phsyically duplicate the information contained in each of the 'Im'
objects. However, if each of the 'Im' objects is a smart (i.e. referenced
counted) pointer, then it is very easy for each 'Pn' object to get a
reference to all of the 'Im' objects. As such, P1 can then process and
delete it's copy of the 'Im' objects independently of when the other 'Pn-1'
objects process and delete their 'Im' objects.
My understanding is that the use of pointers in C# is strongly discouraged.
The question then is there any other way for C# to implement data sharing
functionality similar to that provided by smart pointers in C++?
Thank you to all who respond,
Ian