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