I have two identical fields that are factually identical, but they’re Transform and copying one to the other will link them together. How do I copy one variable’s contents into another without reference cnonnection?
MemberwiseClone() prompts an error:
…(19,30): error CS1540: Cannot access protected member ‘object.MemberwiseClone()’ via a qualifier of type ‘List’; the qualifier must be of type ‘…’ (or derived from it)
Provided solution relies on “ICloneable”, which doesn’t seem to exist by default in C#. Couple other StackOverflow answers provided that “ICloneable is considered a bad API now, since it does not specify whether the result is a deep or a shallow copy. I think this is why they do not improve this interface.”
If anybody is looking for answer it’s second one: List<YourType> newList = new List<YourType>(oldList);