CollectionExt.ThrowIfInvalidIndex<T> Method

Throws an exception if a given index is out of a IReadOnlyCollection<T> bounds.

Namespace: UltimateXR.Extensions.System.Collections
Assembly: UltimateXR (in UltimateXR.dll) Version: 0.0.0.0

Syntax

C#

public static void ThrowIfInvalidIndex<T>(
	this IReadOnlyCollection<T> self,
	int index,
	string paramName = null
)

Parameters

 

self
Type: System.Collections.Generic.IReadOnlyCollection<T>
Collection
index
Type: System.Int32
Index to check if it is out of bounds
paramName (Optional)
Type: System.String
Optional argument name

Type Parameters

 

T
Element type

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IReadOnlyCollection<T>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Exceptions

ExceptionCondition
IndexOutOfRangeExceptionWhen index is out of range and no parameter name was specified
ArgumentOutOfRangeExceptionWhen index is out of range and a parameter name was specified

See Also

Reference

CollectionExt Class
UltimateXR.Extensions.System.Collections Namespace