///resize from >> FieldMergeUtil >> xxComponentSerializer.Merge public static T[] Resize <T>(T[] arr, int length) where T : class, IPatchClass <T>, new() { AssertUtility.Assert(arr == null || arr.Length == 0 || arr.Length == length, "resize a diff length static array"); if (arr == null || arr.Length != length) { arr = new T[length]; } for (int i = 0; i < arr.Length; i++) { if (arr[i] == null) { arr[i] = PatchClassAllocator <T> .Create(); } } return(arr); }