Table of Contents

Class IndexExtensions

Namespace
Garyon.Extensions
Assembly
Garyon.dll

Provides extension functions for the Index type.

public static class IndexExtensions
Inheritance
IndexExtensions
Inherited Members

Methods

GetOffset(Index, Array, int)

Gets the offset for the provided dimension in an array.

[ExcludeFromCodeCoverage]
public static int GetOffset(this Index index, Array array, int dimension)

Parameters

index Index

The index in the dimension.

array Array

The array to get the offset from.

dimension int

The dimension within the array.

Returns

int

The offset.

GetOffset<T>(Index, ICollection<T>)

Gets the offset for the provided dimension in a collection.

[ExcludeFromCodeCoverage]
public static int GetOffset<T>(this Index index, ICollection<T> collection)

Parameters

index Index

The index in the collection.

collection ICollection<T>

The collection to get the offset from.

Returns

int

The offset.

Type Parameters

T

GetOffset<T>(Index, IEnumerable<T>)

Gets the offset for the provided dimension in a collection.

[ExcludeFromCodeCoverage]
public static int GetOffset<T>(this Index index, IEnumerable<T> collection)

Parameters

index Index

The index in the collection.

collection IEnumerable<T>

The collection to get the offset from.

Returns

int

The offset.

Type Parameters

T

GetOffset<T>(Index, T[])

Gets the offset for the provided dimension in a single-dimensional array.

[ExcludeFromCodeCoverage]
public static int GetOffset<T>(this Index index, T[] array)

Parameters

index Index

The index in the array.

array T[]

The array to get the offset from.

Returns

int

The offset.

Type Parameters

T

Invert(Index)

Inverts the index to reflect the respective index symmetric to the middle of the collection.

public static Index Invert(this Index index)

Parameters

index Index

The index to invert.

Returns

Index

The inverted index.