Dict<'K, 'V> Type
A thin wrapper over Collections.Generic.Dictionary<'K,'V> with nicer Error messages on accessing missing keys.
Constructors
Constructor |
Description
|
Full Usage:
Dict(iEqualityComparer)
Parameters:
IEqualityComparer<'K>
Returns: Dict<'K, 'V>
|
Create a new empty Dict<'K,'V> with an IEqualityComparer like HashIdentity.Structural. A Dict is a thin wrapper over System.Collections.Generic.Dictionary<'K,'V> ) with nicer Error messages on accessing missing keys.
|
Create a new empty Dict<'K,'V> . A Dict is a thin wrapper over System.Collections.Generic.Dictionary<'K,'V> ) with nicer Error messages on accessing missing keys.
|
Instance members
Instance member |
Description
|
Full Usage:
this.Add
Parameters:
'K
value : 'V
|
Add the specified key and value to the Dict.
|
Full Usage:
this.AddIfKeyAbsent
Parameters:
'K
value : 'V
Returns: bool
|
Set value only if key does not exist yet.
Returns false if key already exist, does not set value in this case.
Same as
|
Full Usage:
this.AsString
Returns: string
|
A string representation of the Dict including the count of entries and the first 5 entries. When used in Fable this member is inlined for reflection to work.
|
Full Usage:
this.Clear
|
Removes all keys and values from the Dict |
Full Usage:
this.ContainsKey
Parameters:
'K
Returns: bool
|
Determines whether the Dict contains the specified key.
|
Full Usage:
this.ContainsValue
Parameters:
'V
Returns: bool
|
Determines whether the Dict contains a specific value.
|
Full Usage:
this.Count
Returns: int
|
Gets the number of key/value pairs contained in the Dict
|
Full Usage:
this.DoesNotContainKey
Parameters:
'K
Returns: bool
|
Determines whether the Dict does not contains the specified key. not(dic.ContainsKey(key))
|
Full Usage:
this.Get
Parameters:
'K
Returns: 'V
|
Get value for given key
|
|
Returns an enumerator that iterates through the Dict.
|
Full Usage:
this.GetOrSetDefault
Parameters:
'K -> 'V
key : 'K
Returns: 'V
|
If the key ist not present calls the default function, set it as value at the key and return the value. This function is an alternative to the DefaultDic type. Use it if you need to provide a custom implementation of the default function depending on the key.
|
Full Usage:
this.GetOrSetDefaultValue
Parameters:
'V
key : 'K
Returns: 'V
|
If the key ist not present set it as value at the key and return the value.
|
|
Access the underlying Collections.Generic.Dictionary<'K,'V>. ATTENTION! This is not even a shallow copy, mutating it will also change this instance of Dict!
|
Full Usage:
this.IsEmpty
Returns: bool
|
Tests if the Dict is Empty.
|
Full Usage:
this.IsNotEmpty
Returns: bool
|
Tests if the Dict is NOT Empty.
|
Full Usage:
this[k]
Returns: 'K
|
For Index operator .[i]: get or set the value for given key Throws a nice exception if the key is not found.
|
Full Usage:
this.Items
Returns: ('K * 'V) seq
|
Returns a (lazy) sequence of key and value tuples
|
|
Gets a collection containing the keys in the Dict same as on System.Collections.Generic.Dict<'K,'V>
|
Full Usage:
this.KeysSeq
Returns: 'K seq
|
Returns a (lazy) sequence of Keys
|
Full Usage:
this.Pop
Parameters:
'K
Returns: 'V
|
Get a value and remove key and value it from Dict. Will fail if key does not exist
|
Full Usage:
this.Remove
Parameters:
'K
Returns: bool
|
Removes the value with the specified key from the Dict. See also .Pop(key) method that return the contained value.
|
Full Usage:
this.Set
Parameters:
'K
value : 'V
|
Set value for given key, same as the static
|
Full Usage:
this.SetIfKeyAbsent
Parameters:
'K
value : 'V
Returns: bool
|
Set value only if key does not exist yet.
Returns false if key already exist, does not set value in this case.
Same as
|
Full Usage:
this.ToString
Parameters:
int
Returns: string
|
A string representation of the Dict including the count of entries and the specified amount of entries. /// When used in Fable this member is inlined for reflection to work.
|
Full Usage:
this.TryGetValue
Parameters:
'K
-
The input key.
refValue : byref<'V>
-
A reference to the output value.
Returns: bool
true if the value is present, false if not.
|
Lookup an element in the Dict, assigning it to
|
Full Usage:
this.TryPop
Parameters:
'K
Returns: 'V option
|
Try to get a value and remove key and value it from Dict. Returns None if key is not found. Returns Some value if key is found.
|
|
Gets a collection containing the values in the Dict same as on System.Collections.Generic.Dict<'K,'V>
|
Full Usage:
this.ValuesSeq
Returns: 'V seq
|
Returns a (lazy) sequence of values
|
Static members
Static member |
Description
|
|
Constructs a new Dict from a sequence of key-value tuples.
|
|
Constructs a new Dict by using the supplied Dictionary<'K,'V> directly, without any copying of items
|
|
|
|
Set value for given key, same as the static
|