Created
June 4, 2017 14:52
-
-
Save AceAce2025/bbe1ffea5fee87d76af3d9bce8a41565 to your computer and use it in GitHub Desktop.
Revisions
-
AceAce2025 revised this gist
Jun 4, 2017 . 1 changed file with 15 additions and 20 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,22 +1,17 @@ public static class Arrays { public static T[] InitializeWithDefaultInstances < T > (int length) where T: new() { T[] array = new T[length]; for (int i = 0; i < length; i++) { array[i] = new T(); } return array; } public static void DeleteArray < T > (T[] array) where T: System.IDisposable { foreach(T element in array) { if (element != null) element.Dispose(); } } } -
AceAce2025 created this gist
Jun 4, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ public static class Arrays { public static T[] InitializeWithDefaultInstances<T>(int length) where T : new() { T[] array = new T[length]; for (int i = 0; i < length; i++) { array[i] = new T(); } return array; } public static void DeleteArray<T>(T[] array) where T: System.IDisposable { foreach (T element in array) { if (element != null) element.Dispose(); } } }