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
|
|
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:
|
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:
|
Full Usage:
this.FailIfEmpty
Parameters:
string
Returns: 'T[]
Modifiers: inline |
Raises an Exception if the Array is empty (Useful for chaining) Returns the input Array
Extended Type:
|
Full Usage:
this.FailIfLessThan
Parameters:
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:
|
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:
|
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:
|
Full Usage:
this.Get
Parameters:
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:
|
Full Usage:
this.GetLooped
Parameters:
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:
|
Full Usage:
this.GetNeg
Parameters:
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:
|
Full Usage:
this.HasItems
Parameters:
unit
Returns: bool
Modifiers: inline |
Checks if this.Length > 0 Same as xs.IsNotEmpty
Extended Type:
|
Full Usage:
this.Idx
Parameters:
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:
|
Full Usage:
this.IsEmpty
Parameters:
unit
Returns: bool
Modifiers: inline |
Checks if this.Length = 0
Extended Type:
|
Full Usage:
this.IsNotEmpty
Parameters:
unit
Returns: bool
Modifiers: inline |
Checks if this.Length > 0 Same as xs.HasItems
Extended Type:
|
Full Usage:
this.IsSingleton
Parameters:
unit
Returns: bool
Modifiers: inline |
Checks if this.Length = 1
Extended Type:
|
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:
|
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:
|
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:
|
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:
|
Full Usage:
this.Set
Parameters:
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:
|
Full Usage:
this.SetLooped
Parameters:
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:
|
Full Usage:
this.SetNeg
Parameters:
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:
|
Full Usage:
this.Slice
Parameters:
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:
|
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:
|
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:
|
Full Usage:
this.ToString
Parameters:
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:
|
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:
|