ערוך

שתף באמצעות


NIndex.GetOffset(IntPtr) Method

Definition

Calculate the offset from the start using the giving collection length.

public:
 IntPtr GetOffset(IntPtr length);
public IntPtr GetOffset (IntPtr length);
member this.GetOffset : nativeint -> nativeint
Public Function GetOffset (length As IntPtr) As IntPtr

Parameters

length
IntPtr

nativeint

The length of the collection that the NIndex will be used with. length has to be a positive value

Returns

IntPtr

nativeint

Remarks

For performance reason, we don't validate the input length parameter and the returned offset value against negative values. we don't validate either the returned offset is greater than the input length. It is expected NIndex will be used with collections which always have non negative length/count. If the returned offset is negative and then used to NIndex a collection will get out of range exception which will be same affect as the validation.

Applies to