Table of Contents

Class ArrayUtils

Namespace
NanoByte.Common.Collections
Assembly
NanoByte.Common.dll

Provides array-related helper methods.

public static class ArrayUtils
Inheritance
ArrayUtils

Methods

Append<T>(T[], T)

Appends an element to an array.

[Pure]
public static T[] Append<T>(this T[] array, T element)

Parameters

array T[]
element T

Returns

T[]

Type Parameters

T

AsArray<T>(ArraySegment<T>)

Converts an ArraySegment<T> to an array. Avoids copying the underlying array if possible.

public static T[] AsArray<T>(this ArraySegment<T> segment)

Parameters

segment ArraySegment<T>

Returns

T[]

Type Parameters

T

Concat<T>(T[], T[])

Concatenates two array.

[Pure]
public static T[] Concat<T>(this T[] first, T[] second)

Parameters

first T[]
second T[]

Returns

T[]

Type Parameters

T

Concat<T>(params T[][])

Concatenates multiple arrays.

[Pure]
public static T[] Concat<T>(params T[][] arrays)

Parameters

arrays T[][]

Returns

T[]

Type Parameters

T

Prepend<T>(T[], T)

Prepends an element to an array.

[Pure]
public static T[] Prepend<T>(this T[] array, T element)

Parameters

array T[]
element T

Returns

T[]

Type Parameters

T

SequencedEquals<T>(T[], T[], IEqualityComparer<T>?)

Determines whether two arrays contain the same elements in the same order.

[Pure]
public static bool SequencedEquals<T>(this T[] first, T[] second, IEqualityComparer<T>? comparer = null)

Parameters

first T[]

The first of the two collections to compare.

second T[]

The first of the two collections to compare.

comparer IEqualityComparer<T>

Controls how to compare elements; leave null for default comparer.

Returns

bool

Type Parameters

T