Show / Hide Table of Contents

Class ArrayUtils

Provides array-related helper methods.

Inheritance
Object
ArrayUtils
Namespace: NanoByte.Common.Collections
Assembly: NanoByte.Common.dll
Syntax
public static class ArrayUtils : Object

Methods

Append<T>(T[], T)

Appends an element to an array.

Declaration
public static T[] Append<T>(this T[] array, T element)
Parameters
Type Name Description
T[] array
T element
Returns
Type Description
T[]
Type Parameters
Name Description
T

AsArray<T>(ArraySegment<T>)

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

Declaration
public static T[] AsArray<T>(this ArraySegment<T> segment)
Parameters
Type Name Description
ArraySegment<T> segment
Returns
Type Description
T[]
Type Parameters
Name Description
T

Prepend<T>(T[], T)

Prepends an element to an array.

Declaration
public static T[] Prepend<T>(this T[] array, T element)
Parameters
Type Name Description
T[] array
T element
Returns
Type Description
T[]
Type Parameters
Name Description
T

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

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

Declaration
public static bool SequencedEquals<T>(this T[] first, T[] second, IEqualityComparer<T> comparer = null)
Parameters
Type Name Description
T[] first

The first of the two collections to compare.

T[] second

The first of the two collections to compare.

IEqualityComparer<T> comparer

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

Returns
Type Description
Boolean
Type Parameters
Name Description
T
In This Article
Back to top Copyright Bastian Eicher