CSharp examples for System:Array Element
Copy array from start to offset
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Diagnostics; using System;/* w w w.ja va 2 s . c om*/ public class Main{ internal static T[] Copy<T>(this T[] array, int start, int length) { // It's ok for 'start' to equal 'array.Length'. In that case you'll // just get an empty array back. Debug.Assert(start >= 0); Debug.Assert(start <= array.Length); if (start + length > array.Length) { length = array.Length - start; } T[] newArray = new T[length]; Array.Copy(array, start, newArray, 0, length); return newArray; } }