public GDESetTwoDListData ShallowClone() { string newKey = Guid.NewGuid().ToString(); GDESetTwoDListData newClone = new GDESetTwoDListData(newKey); newClone.bool_2dlist = new List <List <bool> >(bool_2dlist); newClone.Set_bool_2dlist(); newClone.int_2dlist = new List <List <int> >(int_2dlist); newClone.Set_int_2dlist(); newClone.float_2dlist = new List <List <float> >(float_2dlist); newClone.Set_float_2dlist(); newClone.string_2dlist = new List <List <string> >(string_2dlist); newClone.Set_string_2dlist(); newClone.vector2_2dlist = new List <List <Vector2> >(vector2_2dlist); newClone.Set_vector2_2dlist(); newClone.vector3_2dlist = new List <List <Vector3> >(vector3_2dlist); newClone.Set_vector3_2dlist(); newClone.vector4_2dlist = new List <List <Vector4> >(vector4_2dlist); newClone.Set_vector4_2dlist(); newClone.color_2dlist = new List <List <Color> >(color_2dlist); newClone.Set_color_2dlist(); newClone.custom_2dlist = new List <List <GDESetCustomData> >(custom_2dlist); newClone.Set_custom_2dlist(); return(newClone); }
public GDESetTwoDListData DeepClone() { GDESetTwoDListData newClone = ShallowClone(); newClone.custom_2dlist = new List <List <GDESetCustomData> >(); if (custom_2dlist != null) { foreach (var sublist in custom_2dlist) { var newSubList = new List <GDESetCustomData>(); if (sublist != null) { foreach (var val in sublist) { newSubList.Add(val.DeepClone()); } } newClone.custom_2dlist.Add(newSubList); } } newClone.Set_custom_2dlist(); return(newClone); }