ArrayHelper Class
Namespace: PTS
Assembly: PTSframework.dll
Provides a set of static methods for generic array types.
Syntax
public static class ArrayHelper
Inheritance
Methods
Append<T>(T[], T[])
Returns new array with items added at the end.
Declaration
public static T[] Append<T>(this T[] array, params T[] newItems)
Parameters
Type | Name | Description |
---|---|---|
T[] | array | Array to add items to. |
T[] | newItems | Items to add to an array. |
Returns
Type | Description |
---|---|
T[] | New array with items appended at the end. |
Type Parameters
Name | Description |
---|---|
T | Type of items in array. |
Remarks
The new array size is the sum of lengths of the original array and appended items.
GetEnumerator<T>(T[])
Casts array to an IEnumerable
and returns enumerator.
Declaration
public static IEnumerator<T> GetEnumerator<T>(this T[] array)
Parameters
Type | Name | Description |
---|---|---|
T[] | array | Aray to get an enumerator for. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<T> | Returns item enumerator. |
Type Parameters
Name | Description |
---|---|
T | Type of items. |
Skip<T>(T[], Int32)
Bypasses a specified number of elements in a sequence and then returns the remaining elements as new array.
Declaration
public static T[] Skip<T>(this T[] array, int count)
Parameters
Type | Name | Description |
---|---|---|
T[] | array | Array to return elements from. |
System.Int32 | count | The number of elements to skip before adding the remaining elements to a new array. |
Returns
Type | Description |
---|---|
T[] | Array of items that contains the elements that occur after the specified index in the input sequence. |
Type Parameters
Name | Description |
---|---|
T | Type of items in array. |
TryGetValue<T>(T[], Int32)
Attemtps to get value at specified index.
Declaration
public static T TryGetValue<T>(this T[] array, int index)
Parameters
Type | Name | Description |
---|---|---|
T[] | array | Array to get an item from. |
System.Int32 | index | Index of an item to retrieve. |
Returns
Type | Description |
---|---|
T | Item at specified index if present, otherwise |
Type Parameters
Name | Description |
---|---|
T | Type of items. |