Class GenericArrayExtensions
Represents a set of extension methods for a T[] array.
Представляет набор методов расширения для массива T[].
Namespace: Platform.Collections.Arrays
Assembly: Platform.Collections.dll
Syntax
public static class GenericArrayExtensions : object
Methods
| Improve this Doc View SourceAdd<T>(T[], ref Int32, T)
Adding in array the passed element at the specified position and increments position value by one.
Добавляет в массив переданный элемент на указанную позицию и увеличивает значение position на единицу.
Declaration
public static void Add<T>(this T[] array, ref int position, T element)
Parameters
Type | Name | Description |
---|---|---|
T[] | array | The array to add the element to. Массив в который необходимо добавить элемент. |
Int32 | position | A reference to the position of type int where the element will be added. Ссылка на позицию типа int, в которую будет добавлен элемент. |
T | element | The element to add to the array. Элемент, который нужно добавить в массив. |
Type Parameters
Name | Description |
---|---|
T | Array elements type. Тип элементов массива. |
Add<T>(T[], ref Int64, T)
Adding in array the passed element at the specified position and increments position value by one.
Добавляет в массив переданный элемент на указанную позицию и увеличивает значение position на единицу.
Declaration
public static void Add<T>(this T[] array, ref long position, T element)
Parameters
Type | Name | Description |
---|---|---|
T[] | array | The array to add the element to. Массив в который необходимо добавить элемент. |
Int64 | position | A reference to the position of type long where the element will be added. Ссылка на позицию типа long, в которую будет добавлен элемент. |
T | element | The element to add to the array Элемент который необходимо добавить в массив. |
Type Parameters
Name | Description |
---|---|
T | Array elements type. Тип элементов массива. |
AddAll<T>(T[], ref Int64, IList<T>)
Adding in array a collection of elements, starting from a specific position and increases the position value by the number of elements added.
Добавляет в массив все элементы коллекции, начиная с определенной позиции и увеличивает значение position на количество добавленных элементов.
Declaration
public static void AddAll<T>(this T[] array, ref long position, IList<T> elements)
Parameters
Type | Name | Description |
---|---|---|
T[] | array | The array to add the element to. Массив в который необходимо добавить элементы. |
Int64 | position | Reference to the position from which elements will be added to the array. Ссылка на позицию, начиная с которой будут добавляться элементы в массив. |
IList<T> | elements | List, whose elements will be added to the array. Список, элементы которого будут добавленны в массив. |
Type Parameters
Name | Description |
---|---|
T | Array elements type. Тип элементов массива. |
AddAllAndReturnConstant<TElement, TReturnConstant>(TElement[], ref Int64, IList<TElement>, TReturnConstant)
Adding in array all elements from the passed collection, at the specified position, increases the position value by the number of elements added and returns the value of the passed constant.
Добавляет в массив все элементы из переданной коллекции, на указанную позицию, увеличивает значение position на количество добавленных элементов и возвращает значение переданной константы.
Declaration
public static TReturnConstant AddAllAndReturnConstant<TElement, TReturnConstant>(this TElement[] array, ref long position, IList<TElement> elements, TReturnConstant returnConstant)
Parameters
Type | Name | Description |
---|---|---|
TElement[] | array | The array to add the element to. Массив в который необходимо добавить элементы. |
Int64 | position | Reference to the position from which elements will be added to the array. Ссылка на позицию, начиная с которой будут добавляться элементы в массив. |
IList<TElement> | elements | List, whose elements will be added to the array. Список, элементы которого будут добавленны в массив. |
TReturnConstant | returnConstant | The constant value that will be returned. Значение константы, которое будет возвращено. |
Returns
Type | Description |
---|---|
TReturnConstant | The constant value passed as an argument. Значение константы, переданное в качестве аргумента. |
Type Parameters
Name | Description |
---|---|
TElement | The array element type. Тип элемента массива. |
TReturnConstant | Type of return constant. Тип возвращаемой константы. |
AddAndReturnConstant<TElement, TReturnConstant>(TElement[], ref Int64, TElement, TReturnConstant)
Adding in array the passed element, at the specified position, increments position value by one and returns the value of the passed constant.
Добавляет в массив переданный элемент на указанную позицию, увеличивает значение position на единицу и возвращает значение переданной константы.
Declaration
public static TReturnConstant AddAndReturnConstant<TElement, TReturnConstant>(this TElement[] array, ref long position, TElement element, TReturnConstant returnConstant)
Parameters
Type | Name | Description |
---|---|---|
TElement[] | array | The array to add the element to. Массив в который необходимо добавить элемент. |
Int64 | position | Reference to the position to which the element will be added. Ссылка на позицию, в которую будет добавлен элемент. |
TElement | element | The element to add to the array. Элемент который необходимо добавить в массив. |
TReturnConstant | returnConstant | The constant value that will be returned. Значение константы, которое будет возвращено. |
Returns
Type | Description |
---|---|
TReturnConstant | The constant value passed as an argument. Значение константы, переданное в качестве аргумента. |
Type Parameters
Name | Description |
---|---|
TElement | The array element type. Тип элемента массива. |
TReturnConstant | Type of return constant. Тип возвращаемой константы. |
AddFirst<T>(T[], ref Int64, IList<T>)
Adds the first element from the passed collection to the array, at the specified position and increments position value by one.
Добавляет в массив первый элемент из переданной коллекции, на указанную позицию и увеличивает значение position на единицу.
Declaration
public static void AddFirst<T>(this T[] array, ref long position, IList<T> elements)
Parameters
Type | Name | Description |
---|---|---|
T[] | array | The array to add the element to. Массив в который необходимо добавить элемент. |
Int64 | position | Reference to the position to which the element will be added. Ссылка на позицию, в которую будет добавлен элемент. |
IList<T> | elements | List, the first element of which will be added to the array. Список, первый элемент которого будет добавлен в массив. |
Type Parameters
Name | Description |
---|---|
T | Array element type. Тип элементов массива. |
AddFirstAndReturnConstant<TElement, TReturnConstant>(TElement[], ref Int64, IList<TElement>, TReturnConstant)
Adds the first element from the passed collection to the array, at the specified position, increments position value by one and returns the value of the passed constant.
Добавляет в массив первый элемент из переданной коллекции, на указанную позицию, увеличивает значение position на единицу и возвращает значение переданной константы.
Declaration
public static TReturnConstant AddFirstAndReturnConstant<TElement, TReturnConstant>(this TElement[] array, ref long position, IList<TElement> elements, TReturnConstant returnConstant)
Parameters
Type | Name | Description |
---|---|---|
TElement[] | array | The array to add the element to. Массив в который необходимо добавить элемент. |
Int64 | position | Reference to the position to which the element will be added. Ссылка на позицию, в которую будет добавлен элемент. |
IList<TElement> | elements | List, the first element of which will be added to the array. Список, первый элемент которого будет добавлен в массив. |
TReturnConstant | returnConstant | The constant value that will be returned. Значение константы, которое будет возвращено. |
Returns
Type | Description |
---|---|
TReturnConstant | The constant value passed as an argument. Значение константы, переданное в качестве аргумента. |
Type Parameters
Name | Description |
---|---|
TElement | The array element type. Тип элемента массива. |
TReturnConstant | Type of return constant. Тип возвращаемой константы. |
AddSkipFirst<T>(T[], ref Int64, IList<T>)
Adding in array all elements of the collection, skipping the first position and increments position value by one.
Добавляет в массив все элементы коллекции, пропуская первую позицию и увеличивает значение position на единицу.
Declaration
public static void AddSkipFirst<T>(this T[] array, ref long position, IList<T> elements)
Parameters
Type | Name | Description |
---|---|---|
T[] | array | The array to add items to. Массив в который необходимо добавить элементы. |
Int64 | position | Reference to the position from which to start adding elements. Ссылка на позицию, с которой начинается добавление элементов. |
IList<T> | elements | List, whose elements will be added to the array. Список, элементы которого будут добавленны в массив. |
Type Parameters
Name | Description |
---|---|
T | Array elements type. Тип элементов массива. |
AddSkipFirst<T>(T[], ref Int64, IList<T>, Int32)
Adding in array all but the first element, skipping a specified number of positions and increments position value by one.
Добавляет в массив все элементы коллекции, кроме первого, пропуская определенное количество позиций и увеличивает значение position на единицу.
Declaration
public static void AddSkipFirst<T>(this T[] array, ref long position, IList<T> elements, int skip)
Parameters
Type | Name | Description |
---|---|---|
T[] | array | The array to add items to. Массив в который необходимо добавить элементы. |
Int64 | position | Reference to the position from which to start adding elements. Ссылка на позицию, с которой начинается добавление элементов. |
IList<T> | elements | List, whose elements will be added to the array. Список, элементы которого будут добавленны в массив. |
Int32 | skip | Number of elements to skip. Количество пропускаемых элементов. |
Type Parameters
Name | Description |
---|---|
T | Array elements type. Тип элементов массива. |
AddSkipFirstAndReturnConstant<TElement, TReturnConstant>(TElement[], ref Int64, IList<TElement>, TReturnConstant)
Adding in array all elements of the collection, skipping the first position, increments position value by one and returns the value of the passed constant.
Добавляет в массив все элементы коллекции, пропуская первую позицию, увеличивает значение position на единицу и возвращает значение переданной константы.
Declaration
public static TReturnConstant AddSkipFirstAndReturnConstant<TElement, TReturnConstant>(this TElement[] array, ref long position, IList<TElement> elements, TReturnConstant returnConstant)
Parameters
Type | Name | Description |
---|---|---|
TElement[] | array | The array to add items to. Массив в который необходимо добавить элементы. |
Int64 | position | Reference to the position from which to start adding elements. Ссылка на позицию, с которой начинается добавление элементов. |
IList<TElement> | elements | List, whose elements will be added to the array. Список, элементы которого будут добавленны в массив. |
TReturnConstant | returnConstant | The constant value that will be returned. Значение константы, которое будет возвращено. |
Returns
Type | Description |
---|---|
TReturnConstant | The constant value passed as an argument. Значение константы, переданное в качестве аргумента. |
Type Parameters
Name | Description |
---|---|
TElement | The array element type. Тип элемента массива. |
TReturnConstant | Type of return constant. Тип возвращаемой константы. |
Clone<T>(T[])
Copying of elements from one array to another array.
Копирует элементы из одного массива в другой массив.
Declaration
public static T[] Clone<T>(this T[] array)
Parameters
Type | Name | Description |
---|---|---|
T[] | array | The array to copy. Массив который необходимо скопировать. |
Returns
Type | Description |
---|---|
T[] | Copy of the array. Копию массива. |
Type Parameters
Name | Description |
---|---|
T | Array elements type. Тип элементов массива. |
GetElementOrDefault<T>(T[], Int32)
Checks if an array exists, if so, checks the array length using the index variable type int, and if the array length is greater than the index - return array[index], otherwise - default value.
Проверяет, существует ли массив, если да - идет проверка длины массива с помощью переменной index, и если длина массива больше индекса - возвращает array[index], иначе - значение по умолчанию.
Declaration
public static T GetElementOrDefault<T>(this T[] array, int index)
Parameters
Type | Name | Description |
---|---|---|
T[] | array | Array that will participate in verification. Массив который будет учавствовать в проверке. |
Int32 | index | Number type int to compare. Число типа int для сравнения. |
Returns
Type | Description |
---|---|
T | Array element or default value. Элемент массива или же значение по умолчанию. |
Type Parameters
Name | Description |
---|---|
T | Array elements type. Тип элементов массива. |
GetElementOrDefault<T>(T[], Int64)
Сhecks whether the array exists, if so, checks the array length using the index variable type long, and if the array length is greater than the index - return array[index], otherwise - default value.
Проверяет, существует ли массив, если да - идет проверка длины массива с помощью переменной index, и если длина массива больше индекса - возвращает array[index], иначе - значение по умолчанию.
Declaration
public static T GetElementOrDefault<T>(this T[] array, long index)
Parameters
Type | Name | Description |
---|---|---|
T[] | array | Array that will participate in verification. Массив который будет учавствовать в проверке. |
Int64 | index | Number type long to compare. Число типа long для сравнения. |
Returns
Type | Description |
---|---|
T | Array element or default value. Элемент массива или же значение по умолчанию. |
Type Parameters
Name | Description |
---|---|
T | Array elements type. Тип элементов массива. |
ShiftRight<T>(T[])
Shifts all the elements of the array by one position to the right.
Сдвигает вправо все элементы массива на одну позицию.
Declaration
public static IList<T> ShiftRight<T>(this T[] array)
Parameters
Type | Name | Description |
---|---|---|
T[] | array | The array to copy from. Массив для копирования. |
Returns
Type | Description |
---|---|
IList<T> | Array with a shift of elements by one position. Массив со сдвигом элементов на одну позицию. |
Type Parameters
Name | Description |
---|---|
T | The array item type. Тип элементов массива. |
ShiftRight<T>(T[], Int64)
Shifts all elements of the array to the right by the specified number of elements.
Сдвигает вправо все элементы массива на указанное количество элементов.
Declaration
public static IList<T> ShiftRight<T>(this T[] array, long shift)
Parameters
Type | Name | Description |
---|---|---|
T[] | array | The array to copy from. Массив для копирования. |
Int64 | shift | The number of items to shift. Количество сдвигаемых элементов. |
Returns
Type | Description |
---|---|
IList<T> | If the value of the shift variable is less than zero - an Если значение переменной shift меньше нуля - выбрасывается исключение |
Type Parameters
Name | Description |
---|---|
T | The array item type. Тип элементов массива. |
TryGetElement<T>(T[], Int32, out T)
Checks whether the array exist, if so, checks the array length using the index varible type int, and if the array length is greater than the index, set the element variable to array[index] and return true.
Проверяет, существует ли массив, если да, то идет проверка длины массива с помощью переменной index типа int, и если длина массива больше значения index, устанавливает значение переменной element - array[index] и возвращает true.
Declaration
public static bool TryGetElement<T>(this T[] array, int index, out T element)
Parameters
Type | Name | Description |
---|---|---|
T[] | array | Array that will participate in verification. Массив который будет учавствовать в проверке. |
Int32 | index | Number type int to compare. Число типа int для сравнения. |
T | element | Passing the argument by reference, if successful, it will take the value array[index] otherwise default value. Передает аргумент по ссылке, в случае успеха он примет значение array[index] в противном случае значение по умолчанию. |
Returns
Type | Description |
---|---|
Boolean | true if successful otherwise false. true в случае успеха, в противном случае false. |
Type Parameters
Name | Description |
---|---|
T | Array elements type. Тип элементов массива. |
TryGetElement<T>(T[], Int64, out T)
Checks whether the array exist, if so, checks the array length using the index varible type long, and if the array length is greater than the index, set the element variable to array[index] and return true.
Проверяет, существует ли массив, если да, то идет проверка длины массива с помощью переменной index типа long, и если длина массива больше значения index, устанавливает значение переменной element - array[index] и возвращает true.
Declaration
public static bool TryGetElement<T>(this T[] array, long index, out T element)
Parameters
Type | Name | Description |
---|---|---|
T[] | array | Array that will participate in verification. Массив который будет учавствовать в проверке. |
Int64 | index | Number type long to compare. Число типа long для сравнения. |
T | element | Passing the argument by reference, if successful, it will take the value array[index] otherwise default value. Передает аргумент по ссылке, в случае успеха он примет значение array[index] в противном случае значение по умолчанию. |
Returns
Type | Description |
---|---|
Boolean | true if successful otherwise false. true в случае успеха, в противном случае false |
Type Parameters
Name | Description |
---|---|
T | Array elements type. Тип элементов массива. |