Let’s say I have a custom class CustomClass, and I have a collection deriving from CollectionBase class named CustomClassCollection. Let’s say I do something like this:
CustomClassCollection a = new CustomClassCollection();
CustomClassCollection b = a;
When I change the CustomClass elements in a, the elements in b are also changed. How should I write these classes so that when I assign a to b and change the elements of b, a still stays the same?
You need a
Clone(implementingIClonable) or a copy constructor forCustomClassCollection.