Class ArrayExtensions
- Namespace
- Stride.Core.Extensions
- Assembly
- Stride.Core.dll
Extensions for list and arrays.
public static class ArrayExtensions
- Inheritance
-
ArrayExtensions
Methods
ArraysEqual<T>(IList<T>, IList<T>, IEqualityComparer<T>)
Deeply compares of two IList<T>.
public static bool ArraysEqual<T>(IList<T> a1, IList<T> a2, IEqualityComparer<T> comparer = null)
Parameters
a1
IList<T>The list1 to compare
a2
IList<T>The list2 to compare
comparer
IEqualityComparer<T>The comparer to use (or default to the default EqualityComparer for T)
Returns
- bool
true
if the list are equal
Type Parameters
T
Type of the object to compare
ArraysReferenceEqual<T>(FastListStruct<T>, FastListStruct<T>)
Compares of two FastListStruct<T> using operator !=.
public static bool ArraysReferenceEqual<T>(FastListStruct<T> a1, FastListStruct<T> a2) where T : class
Parameters
a1
FastListStruct<T>The list1 to compare
a2
FastListStruct<T>The list2 to compare
Returns
- bool
true
if the list are equal
Type Parameters
T
Type of the object to compare
ArraysReferenceEqual<T>(ref FastListStruct<T>, ref FastListStruct<T>)
Compares of two FastListStruct<T> using operator !=.
public static bool ArraysReferenceEqual<T>(ref FastListStruct<T> a1, ref FastListStruct<T> a2) where T : class
Parameters
a1
FastListStruct<T>The list1 to compare
a2
FastListStruct<T>The list2 to compare
Returns
- bool
true
if the list are equal
Type Parameters
T
Type of the object to compare
ArraysReferenceEqual<T>(IList<T>, IList<T>)
Compares of two IList<T> using operator !=.
public static bool ArraysReferenceEqual<T>(IList<T> a1, IList<T> a2) where T : class
Parameters
Returns
- bool
true
if the list are equal
Type Parameters
T
Type of the object to compare
ComputeHash<T>(ICollection<T>, IEqualityComparer<T>)
Computes the hash of a collection using hash of each elements.
public static int ComputeHash<T>(this ICollection<T> data, IEqualityComparer<T> comparer = null)
Parameters
data
ICollection<T>The list to generates the hash
comparer
IEqualityComparer<T>The comparer to use (or use the default comparer otherwise)
Returns
- int
The hashcode of the collection.
Type Parameters
T
Type of the object to calculate the hash
ComputeHash<T>(T[], IEqualityComparer<T>)
Computes the hash of the array.
public static int ComputeHash<T>(this T[] data, IEqualityComparer<T> comparer = null)
Parameters
data
T[]The array to generates the hash
comparer
IEqualityComparer<T>The comparer to use (or use the default comparer otherwise)
Returns
- int
The hashcode of the array.
Type Parameters
T
Type of the object to calculate the hash
Concat<T>(T[], T[])
Concats two arrays.
public static T[] Concat<T>(this T[] array1, T[] array2)
Parameters
array1
T[]The array1 to concat
array2
T[]The array2 to concat
Returns
- T[]
The concat of the array.
Type Parameters
T
Type of the array element
SubArray<T>(T[], int, int)
Extracts a sub-array from an array.
public static T[] SubArray<T>(this T[] data, int index, int length)
Parameters
data
T[]The array to slice
index
intThe start of the index to get the data from.
length
intThe length of elements to slice
Returns
- T[]
A slice of the array.
Type Parameters
T
Type of the array element