Provides extension methods for arrays.
More...
|
static T[] | Append< T > (this T[] array, T element) |
| Appends an element to an array. More...
|
|
static T[] | Prepend< T > (this T[] array, T element) |
| Prepends an element to an array. More...
|
|
static bool | SequencedEquals< T > (this T[] first, T[] second, IEqualityComparer< T >? comparer=null) |
| Determines whether two arrays contain the same elements in the same order. More...
|
|
static T[] | GetAddedElements< T > (this T[]? newArray, T[]? oldArray) |
| Assumes two sorted arrays. Determines which elements are present in newArray but not in oldArray . More...
|
|
static T[] | GetAddedElements< T > (this T[]? newArray, T[]? oldArray, IComparer< T > comparer) |
| Assumes two sorted arrays. Determines which elements are present in newArray but not in oldArray . More...
|
|
Provides extension methods for arrays.
◆ Append< T >()
static T [] NanoByte.Common.Collections.ArrayExtensions.Append< T > |
( |
this T[] |
array, |
|
|
T |
element |
|
) |
| |
|
inlinestatic |
Appends an element to an array.
◆ GetAddedElements< T >() [1/2]
static T [] NanoByte.Common.Collections.ArrayExtensions.GetAddedElements< T > |
( |
this T?[] |
newArray, |
|
|
T?[] |
oldArray |
|
) |
| |
|
static |
Assumes two sorted arrays. Determines which elements are present in newArray but not in oldArray .
- Parameters
-
newArray | The new list of elements; can be null (will be treated as an empty array). |
oldArray | The original list of elements; can be null (will be treated as an empty array). |
- Returns
- An array of elements that were added.
Elements that are present in oldArray but not in newArray are ignored. Elements that are equal for IComparable<T>.CompareTo but have been otherwise modified will be added.
- Type Constraints
-
T | : | IComparable<T> | |
T | : | IEquatable<T> | |
T | : | GetAddedElements | |
T | : | newArray | |
T | : | oldArray | |
T | : | DefaultComparer<T> | |
T | : | Instance | |
◆ GetAddedElements< T >() [2/2]
static T [] NanoByte.Common.Collections.ArrayExtensions.GetAddedElements< T > |
( |
this T?[] |
newArray, |
|
|
T?[] |
oldArray, |
|
|
IComparer< T > |
comparer |
|
) |
| |
|
inlinestatic |
Assumes two sorted arrays. Determines which elements are present in newArray but not in oldArray .
- Parameters
-
newArray | The new list of elements; can be null (will be treated as an empty array). |
oldArray | The original list of elements; can be null (will be treated as an empty array). |
comparer | An object that compares to elements to determine which one is bigger. |
- Returns
- An array of elements that were added.
Elements that are present in oldArray but not in newArray are ignored. Elements that are equal for IComparable<T>.CompareTo but have been otherwise modified will be added.
◆ Prepend< T >()
static T [] NanoByte.Common.Collections.ArrayExtensions.Prepend< T > |
( |
this T[] |
array, |
|
|
T |
element |
|
) |
| |
|
inlinestatic |
Prepends an element to an array.
◆ SequencedEquals< T >()
static bool NanoByte.Common.Collections.ArrayExtensions.SequencedEquals< T > |
( |
this T[] |
first, |
|
|
T[] |
second, |
|
|
IEqualityComparer< T >? |
comparer = null |
|
) |
| |
|
inlinestatic |
Determines whether two arrays contain the same elements in the same order.
- Parameters
-
first | The first of the two collections to compare. |
second | The first of the two collections to compare. |
comparer | Controls how to compare elements; leave null for default comparer. |
The documentation for this class was generated from the following file:
- Common/Collections/ArrayExtensions.cs