Remove First element from Array - CSharp System

CSharp examples for System:Array Slice

Description

Remove First element from Array

Demo Code

// 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[] RemoveFirst<T>(this T[] array)
        {/*from  ww w  . java  2  s.c  om*/
            T[] result = new T[array.Length - 1];
            Array.Copy(array, 1, result, 0, result.Length);
            return result;
        }
}

Related Tutorials