MegaBites-AI/Windows-powershell
0308
1// Licensed to the .NET Foundation under one or more agreements.2// The .NET Foundation licenses this file to you under the MIT license.3 4using System;5using System.Collections.Generic;6 7namespace System.Management.Automation.ComInterop8{9 internal static class CollectionExtensions10 {11 internal static T[] RemoveFirst<T>(this T[] array)12 {13 T[] result = new T[array.Length - 1];14 Array.Copy(array, 1, result, 0, result.Length);15 return result;16 }17 18 internal static T[] AddFirst<T>(this IList<T> list, T item)19 {20 T[] res = new T[list.Count + 1];21 res[0] = item;22 list.CopyTo(res, 1);23 return res;24 }25 26 internal static T[] ToArray<T>(this IList<T> list)27 {28 T[] res = new T[list.Count];29 list.CopyTo(res, 0);30 return res;31 }32 33 internal static T[] AddLast<T>(this IList<T> list, T item)34 {35 T[] res = new T[list.Count + 1];36 list.CopyTo(res, 0);37 res[list.Count] = item;38 return res;39 }40 }41}42 