Hi All
I was developing C++/Cli library to use C++ third party library in my C# application.I wrote a method to retrive the collection of datasets from
CLI library to C#.
The method exposed from CLI library is void Query(List<Dictionary<int ,String^>^>^ %data);
here i am using reference type in List. is it good to use reference types than value types in List?
since it is a reference type the memory will be handled by gc. Does it affects my list when i am reading
it in C# application. When GC will free the memory in this case?
The GC will only free the memory when there are no more references to the objects involved - you don't need to worry about the GC. You only need to be aware of the differences between reference and value types, especially if you need to create a deep copy of the list for some reason.
I recently wrote an explanation of ref & val types in a different thread, so if you're interested, check it out.
Bookmarks