Hello,
I believed that structure is a reference type.
- public struct struct_A
- {
- public int struct_member1;
- public int struct_member2;
- public int struct_member3;
- }
-
- struct_A [] arrA_1 = new struct_A [7];
- struct_A [] arrA_2 = new struct_A [7];
-
- List<struct_A> lst_A = new List<struct_A>();
-
-
- for (int i = 0; i < arrA_1.Length; i++)
- {
- lst_A.Add(arrA_1[i];
- lst_A.Add(arrA_2[i];
- }
Then I assign arrA_1[0]. struct_member2:
- arrA_1[2].struct_member2 = 10;
and check lst_A[0]. struct_member2:- int check_value = lst_A[0].struct_member2
The check_value should be 10, but it isn't. Why ?
Thanks in advance.