CSharp examples for System:Array Slice
Remove Last Element from Array
// The .NET Foundation licenses this file to you under the MIT license. using System.Runtime.CompilerServices; using System.Collections.ObjectModel; using System.Collections.Generic; using System.Diagnostics.Contracts; public class Main{ public static T[] RemoveLast<T>(this T[] array) {//from w w w.jav a 2 s . c om T[] result = new T[array.Length - 1]; Array.Copy(array, 0, result, 0, result.Length); return result; } }