Skip to content

Instantly share code, notes, and snippets.

@martindevans
Last active March 1, 2018 01:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martindevans/0fb9d34f53446c0f46737de8fe89bf48 to your computer and use it in GitHub Desktop.
Save martindevans/0fb9d34f53446c0f46737de8fe89bf48 to your computer and use it in GitHub Desktop.
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