Click or drag to resize

IndexCollectionFromArray Method (Int32, Boolean)

Initializes a new instance of the IndexCollection class whose elements are stored in the specified array.

Namespace:  Novacta.Analytics
Assembly:  Novacta.Analytics (in Novacta.Analytics.dll) Version: 2.0.0
Syntax
public static IndexCollection FromArray(
	int[] indexes,
	bool copyIndexes
)

Parameters

indexes
Type: SystemInt32
The array that stores the elements of the new IndexCollection instance.
copyIndexes
Type: SystemBoolean
true if indexes must be copied before instantiation; otherwise false.

Return Value

Type: IndexCollection
A collection using the specified array to store its indexes.
Exceptions
ExceptionCondition
ArgumentNullExceptionindexes is null.
ArgumentException The Length of indexes is zero.
-or-
indexes contains a negative element.
Remarks

The FromArray(Int32, Boolean) method prevents the copy of the elements in indexes before instantiation if copyIndexes evaluates to false: the returned IndexCollection instance will use a direct reference to indexes to manipulate its indexes.

Caution note Caution
This method is intended for advanced users and must always be used carefully. If the value of copyIndexes is false, do not use this method if you do not have complete control of the indexes array. Once the array is passed to the method as an argument, it must be treated as a read-only object outside the returned instance: you can set elements via the IndexCollection API, but you shouldn't manipulate its entries via a direct reference to indexes: otherwise, the behavior of the returned IndexCollection instance must be considered as undefined and almost surely prone to errors.

See Also