Header menu logo ArrayT

AutoOpenArrayTExtensions Module

Extension methods for Array<'T>. Like .Last , .IsNotEmpty ,.. This module is automatically opened when the namespace ArrayT is opened.

Type extensions

Type extension Description

this.DebugIdx

Full Usage: this.DebugIdx

Parameters:
    () : unit

Returns: DebugIndexer<'T>

Use for Debugging index get/set operations. Just replace 'myArray.[3]' with 'myArray.DebugIdx.[3]' Throws a nice descriptive Exception if the index is out of range including the bad index and the array content.

Extended Type: []

() : unit
Returns: DebugIndexer<'T>

this.Duplicate

Full Usage: this.Duplicate

Parameters:
    () : unit

Returns: 'T array
Modifiers: inline

Creates a new Array with the same items as the input Array. Shallow copy only. this.Clone() :?> 'T array

Extended Type: []

() : unit
Returns: 'T array

this.FailIfEmpty

Full Usage: this.FailIfEmpty

Parameters:
    errorMessage : string

Returns: 'T[]
Modifiers: inline

Raises an Exception if the Array is empty (Useful for chaining) Returns the input Array

Extended Type: []

errorMessage : string
Returns: 'T[]

this.FailIfLessThan

Full Usage: this.FailIfLessThan

Parameters:
    count : int
    errorMessage : string

Returns: 'T[]
Modifiers: inline

Raises an Exception if the Array has less then count items. (Useful for chaining) Returns the input Array

Extended Type: []

count : int
errorMessage : string
Returns: 'T[]

this.First

Full Usage: this.First

Parameters:
    () : unit

Returns: 'T
Modifiers: inline

Get (or set) the first item in the Array. Equal to this.[0]

Extended Type: []

() : unit
Returns: 'T

this.FirstAndOnly

Full Usage: this.FirstAndOnly

Parameters:
    () : unit

Returns: 'T
Modifiers: inline

Gets the the only item in the Array. Fails if the Array does not have exactly one element.

Extended Type: []

() : unit
Returns: 'T

this.Get

Full Usage: this.Get

Parameters:
    index : int

Returns: 'T
Modifiers: inline

Gets an item at index, same as this.[index] or this.Idx(index) Throws a descriptive Exception if the index is out of range including the bad index and the Array content. (Use this.GetNeg(i) member if you want to use negative indices too)

Extended Type: []

index : int
Returns: 'T

this.GetLooped

Full Usage: this.GetLooped

Parameters:
    index : int

Returns: 'T
Modifiers: inline

Any index will return a value. Array is treated as an endless loop in positive and negative direction

Extended Type: []

index : int
Returns: 'T

this.GetNeg

Full Usage: this.GetNeg

Parameters:
    index : int

Returns: 'T
Modifiers: inline

Gets an item in the Array by index. Allows for negative index too ( -1 is last item, like Python) (From the release of F# 5 on a negative index can also be done with '^' prefix. E.g. ^0 for the last item)

Extended Type: []

index : int
Returns: 'T

this.HasItems

Full Usage: this.HasItems

Parameters:
    () : unit

Returns: bool
Modifiers: inline

Checks if this.Length > 0 Same as xs.IsNotEmpty

Extended Type: []

() : unit
Returns: bool

this.Idx

Full Usage: this.Idx

Parameters:
    index : int

Returns: 'T
Modifiers: inline

Gets an item at index, same as this.[index] or this.Get(index) Throws a descriptive Exception if the index is out of range. (Use this.GetNeg(i) member if you want to use negative indices too)

Extended Type: []

index : int
Returns: 'T

this.IsEmpty

Full Usage: this.IsEmpty

Parameters:
    () : unit

Returns: bool
Modifiers: inline

Checks if this.Length = 0

Extended Type: []

() : unit
Returns: bool

this.IsNotEmpty

Full Usage: this.IsNotEmpty

Parameters:
    () : unit

Returns: bool
Modifiers: inline

Checks if this.Length > 0 Same as xs.HasItems

Extended Type: []

() : unit
Returns: bool

this.IsSingleton

Full Usage: this.IsSingleton

Parameters:
    () : unit

Returns: bool
Modifiers: inline

Checks if this.Length = 1

Extended Type: []

() : unit
Returns: bool

this.Last

Full Usage: this.Last

Parameters:
    () : unit

Returns: 'T
Modifiers: inline

Get (or set) the last item in the Array. Equal to this.[this.Length - 1]

Extended Type: []

() : unit
Returns: 'T

this.LastIndex

Full Usage: this.LastIndex

Parameters:
    () : unit

Returns: int
Modifiers: inline

Gets the index of the last item in the Array. Equal to this.Length - 1 Returns -1 for empty Array.

Extended Type: []

() : unit
Returns: int

this.Second

Full Usage: this.Second

Parameters:
    () : unit

Returns: 'T
Modifiers: inline

Get (or set) the second item in the Array. Equal to this.[1]

Extended Type: []

() : unit
Returns: 'T

this.SecondLast

Full Usage: this.SecondLast

Parameters:
    () : unit

Returns: 'T
Modifiers: inline

Get (or set) the second last item in the Array. Equal to this.[this.Length - 2]

Extended Type: []

() : unit
Returns: 'T

this.Set

Full Usage: this.Set

Parameters:
    index : int
    value : 'T

Modifiers: inline

Sets an item at index (Use this.SetNeg(i) member if you want to use negative indices too)

Extended Type: []

index : int
value : 'T

this.SetLooped

Full Usage: this.SetLooped

Parameters:
    index : int
    value : 'T

Modifiers: inline

Any index will set a value. Array is treated as an endless loop in positive and negative direction

Extended Type: []

index : int
value : 'T

this.SetNeg

Full Usage: this.SetNeg

Parameters:
    index : int
    value : 'T

Modifiers: inline

Sets an item in the Array by index. Allows for negative index too ( -1 is last item, like Python) (from the release of F# 5 on a negative index can also be done with '^' prefix. E.g. ^0 for the last item)

Extended Type: []

index : int
value : 'T

this.Slice

Full Usage: this.Slice

Parameters:
    startIdx : int
    endIdx : int

Returns: 'T array

Allows for negative indices too. ( -1 is last item, like Python) The resulting array includes the end index. The built in slicing notation (e.g. a.[1..3]) for arrays does not allow for negative indices. (and can't be overwritten) Alternative: from the release of F# 5 on a negative index can also be done with '^' prefix. E.g. ^0 for the last item.

Extended Type: []

startIdx : int
endIdx : int
Returns: 'T array

this.Third

Full Usage: this.Third

Parameters:
    () : unit

Returns: 'T
Modifiers: inline

Get (or set) the third item in the Array. Equal to this.[2]

Extended Type: []

() : unit
Returns: 'T

this.ThirdLast

Full Usage: this.ThirdLast

Parameters:
    () : unit

Returns: 'T
Modifiers: inline

Get (or set) the third last item in the Array. Equal to this.[this.Length - 3]

Extended Type: []

() : unit
Returns: 'T

this.ToString

Full Usage: this.ToString

Parameters:
    entriesToPrint : int

Returns: string

A string representation of the Array including the count of entries and the specified amount of entries. When used in Fable this member is inlined for reflection to work.

Extended Type: []

entriesToPrint : int
Returns: string

this.asString ()

Full Usage: this.asString ()

Parameters:
    () : unit

Returns: string

A string representation of the Array including the count of entries and the first 5 entries. When used in Fable this member is inlined for reflection to work.

Extended Type: []

() : unit
Returns: string

Type something to start searching.