You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jellyfin/Emby.Server.Implementations/IO/SharpCifs/Util/Sharpen/Arrays.cs

60 lines
1.1 KiB

using System;
using System.Collections.Generic;
using System.Linq;
namespace SharpCifs.Util.Sharpen
{
public class Arrays
{
public static List<T> AsList<T> (params T[] array)
{
return array.ToList ();
}
public static bool Equals<T> (T[] a1, T[] a2)
{
if (a1.Length != a2.Length) {
return false;
}
return !a1.Where((t, i) => !t.Equals(a2[i])).Any();
}
public static void Fill<T> (T[] array, T val)
{
Fill (array, 0, array.Length, val);
}
public static void Fill<T> (T[] array, int start, int end, T val)
{
for (int i = start; i < end; i++) {
array[i] = val;
}
}
public static void Sort (string[] array)
{
Array.Sort (array, (s1,s2) => string.CompareOrdinal (s1,s2));
}
public static void Sort<T> (T[] array)
{
Array.Sort (array);
}
public static void Sort<T> (T[] array, IComparer<T> c)
{
Array.Sort (array, c);
}
public static void Sort<T> (T[] array, int start, int count)
{
Array.Sort (array, start, count);
}
public static void Sort<T> (T[] array, int start, int count, IComparer<T> c)
{
Array.Sort (array, start, count, c);
}
}
}