1
Answer

Custom types

Ask a question
Krivahn Doss

Krivahn Doss

14y
2.3k
1

I have a generic list of custome types. list<MyType> where MyType is a class so that makes
it a reference type. I have the following
List<MyType> myType1 = new List<MyType>();
List<MyType> myType2 = new List<MyType>();
myType2 = myType1;
How do I assign myType2 to point to a different part in memory or to a value type.
I also tried the following but when myType1 list changes the changes occure in myList2
as well.
List<MyType> myType2 = new List<Mytype>(myType1);

Answers (1)
Next Recommended Forum