Last active
March 1, 2018 01:59
-
-
Save martindevans/0fb9d34f53446c0f46737de8fe89bf48 to your computer and use it in GitHub Desktop.
This file contains 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 characters
static class ArrExt | |
{ | |
public static T[] Clone<T>(this T[] arr) | |
{ | |
var clone = new T[arr.Length]; | |
for (var i = 0; i < arr.Length; i++) | |
clone[i] = arr[i]; | |
return clone; | |
} | |
} | |
//Now you can do this: | |
var array = new int[123]; | |
var clone = array.Clone(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment