Dictionary<T,U>

Overview

Dictionary implementation maps a given unique key of type T to a value of type U.

Location

 

constructor    (declared in Object)

Default constructor.

 

constructor

 

Dictionary<T,U>()

 

init()

 

Dictionary<T,U>()

constructor (IEqualityComparer<T>) watchOS-arm64

Constructor with non default equality comparer.

 

constructor(aComparer: IEqualityComparer<T>)

 

Dictionary<T,U>(IEqualityComparer<T> aComparer)

 

init(_ aComparer: IEqualityComparer<T>)

 

Dictionary<T,U>(IEqualityComparer<T> aComparer)

Parameters:

  • aComparer: The comparer to use.

constructor (Int32)

Constructor with capacity.

 

constructor(aCapacity: Int32)

 

Dictionary<T,U>(Int32 aCapacity)

 

init(_ aCapacity: Int32)

 

Dictionary<T,U>(Int32 aCapacity)

Parameters:

  • aCapacity: The initial capacity.

constructor (Int32, IEqualityComparer<T>) watchOS-arm64

Constructor with non default equality comparer and initial capacity.

 

constructor(aCapacity: Int32; aComparer: IEqualityComparer<T>)

 

Dictionary<T,U>(Int32 aCapacity, IEqualityComparer<T> aComparer)

 

init(_ aCapacity: Int32, _ aComparer: IEqualityComparer<T>)

 

Dictionary<T,U>(Int32 aCapacity, IEqualityComparer<T> aComparer)

Parameters:

  • aCapacity: The initial capacity.
  • aComparer: The comparer to use.

Add

Adds an item to the dictionary; Fails if Key is already present.

 

method Add(Key: T; Value: U)

 

void Add(T Key, U Value)

 

func Add(_ Key: T, _ Value: U)

 

void Add(T Key, U Value)

Parameters:

  • Key: The key for this item
  • Value: The value for this item

Clear

Clears all items from this dictionary.

 

method Clear

 

void Clear()

 

func Clear()

 

void Clear()

ContainsKey watchOS-arm64

Returns true if the dictionary contains this key.

 

method ContainsKey(Key: T): Boolean

 

Boolean ContainsKey(T Key)

 

func ContainsKey(_ Key: T) -> Boolean

 

Boolean ContainsKey(T Key)

Parameters:

  • Key: The key to find

ContainsValue watchOS-arm64

Iterators the dictionary and checks if it contains this value.

 

method ContainsValue(Value: U): Boolean

 

Boolean ContainsValue(U Value)

 

func ContainsValue(_ Value: U) -> Boolean

 

Boolean ContainsValue(U Value)

Parameters:

  • Value: The value to find.

Count watchOS-arm64

Returns the nr of elements in this dictionary.

 

property Count: Int32 read;

 

Int32 Count { get; }

 

var Count: Int32 { get{} }

 

Int32 Count { __get; }

Equals  virtual    (declared in Object)

Returns true if the target object matches this one, by default compares the reference.

 

method Equals(obj: Object): Boolean

 

Boolean Equals(Object obj)

 

func Equals(_ obj: Object) -> Boolean

 

Boolean Equals(Object obj)

Parameters:

  • obj: the reference to compare this with.

Finalize  protected virtual    (declared in Object)

Finalizer implementation. If not overriden it's not called at all, the runtime checks if there is an override before calling a finalizer.

 

method Finalize

 

void Finalize()

 

func Finalize()

 

void Finalize()

ForEach watchOS-arm64

Iterates this dictionary and triggers the action for every item.

 

method ForEach(Action: Action<KeyValuePair<T, U>>)

 

void ForEach(Action<KeyValuePair<T, U>> Action)

 

func ForEach(_ Action: Action<KeyValuePair<T, U>>)

 

void ForEach(Action1<KeyValuePair<T, U>> Action)

Parameters:

  • Action: Action to run.

GetEnumerator  virtual    (declared in ImmutableDictionary<T,U>) Android, iOS, iOS Simulator, macOS, tvOS, tvOS Simulator, Ubuntu, UIKit for Mac, watchOS Simulator, watchOS-arm64_32, watchOS-armv7k, WebAssembly, Windows

Iterator.

 

method GetEnumerator: IEnumerator<KeyValuePair<T, U>>

 

IEnumerator<KeyValuePair<T, U>> GetEnumerator()

 

func GetEnumerator() -> IEnumerator<KeyValuePair<T, U>>

 

IEnumerator<KeyValuePair<T, U>> GetEnumerator()

GetHashCode  virtual    (declared in Object)

Returns a hashcode for this object. Overriden implementations should make sure that the number returned here is constant given the same object.

 

method GetHashCode: Int32

 

Int32 GetHashCode()

 

func GetHashCode() -> Int32

 

Int32 GetHashCode()

GetSequence watchOS-arm64

Iterator implementation for this dictionary.

 

method GetSequence: IEnumerable<KeyValuePair<T,U>>

 

IEnumerable<KeyValuePair<T,U>> GetSequence()

 

func GetSequence() -> IEnumerable<KeyValuePair<T,U>>

 

IEnumerable<KeyValuePair<T,U>> GetSequence()

GetType    (declared in Object)

Returns the actual type of this class

 

method GetType: Type

 

Type GetType()

 

func GetType() -> Type

 

Type GetType()

Item  override virtual

Indexer. Throws an exception if the item for Key is not present.

 

property Item[Key: T]: U read write;

 

U Item[T Key] { get; set; }

 

subscript Item(_ Key: T) -> U { get{} set{} }

 

U Item[T Key] { __get; __set; }

Keys watchOS-arm64

Returns an iterator on all keys.

 

property Keys: IEnumerable<T> read;

 

IEnumerable<T> Keys { get; }

 

var Keys: IEnumerable<T> { get{} }

 

IEnumerable<T> Keys { __get; }

ReferenceEquals    (declared in Object)

Compares two references for equivalence (even if they have an equals operator)

 

class method ReferenceEquals(a: Object; b: Object): Boolean

 

static Boolean ReferenceEquals(Object a, Object b)

 

static func ReferenceEquals(_ a: Object, _ b: Object) -> Boolean

 

static Boolean ReferenceEquals(Object a, Object b)

Parameters:

  • a: left value
  • b: right value

Remove

Removes an item from the dictionary, returns true if it was there.

 

method Remove(Key: T): Boolean

 

Boolean Remove(T Key)

 

func Remove(_ Key: T) -> Boolean

 

Boolean Remove(T Key)

Parameters:

  • Key: The key to remove.

ToNSDictionary watchOS-arm64

Explicit operator to cast to NSMutableDictionary.

 

method ToNSDictionary: NSDictionary<T, U>

 

NSDictionary<T, U> ToNSDictionary()

 

func ToNSDictionary() -> NSDictionary<T, U>

 

NSDictionary<T, U> ToNSDictionary()

ToNSMutableDictionary watchOS-arm64

Explicit operator to cast to NSMutableDictionary.

 

method ToNSMutableDictionary: NSMutableDictionary<T, U>

 

NSMutableDictionary<T, U> ToNSMutableDictionary()

 

func ToNSMutableDictionary() -> NSMutableDictionary<T, U>

 

NSMutableDictionary<T, U> ToNSMutableDictionary()

ToString  virtual    (declared in Object)

Gets the string representation of this method.

 

method ToString: String

 

String ToString()

 

func ToString() -> String

 

String ToString()

TryGetValue watchOS-arm64

Returns a value for a given key into aValue, and returns if it was present or not.

 

method TryGetValue(aKey: T; out aValue: U): Boolean

 

Boolean TryGetValue(T aKey, out U aValue)

 

func TryGetValue(_ aKey: T, _ aValue: U) -> Boolean

 

Boolean TryGetValue(T aKey, __out U aValue)

Parameters:

  • aKey: Key to find
  • aValue: The resulting value.

Values watchOS-arm64

Returns an iterator on all values.

 

property Values: IEnumerable<U> read;

 

IEnumerable<U> Values { get; }

 

var Values: IEnumerable<U> { get{} }

 

IEnumerable<U> Values { __get; }

 

Count watchOS-arm64

Returns the nr of elements in this dictionary.

 

property Count: Int32 read;

 

Int32 Count { get; }

 

var Count: Int32 { get{} }

 

Int32 Count { __get; }

Item  override virtual

Indexer. Throws an exception if the item for Key is not present.

 

property Item[Key: T]: U read write;

 

U Item[T Key] { get; set; }

 

subscript Item(_ Key: T) -> U { get{} set{} }

 

U Item[T Key] { __get; __set; }

Keys watchOS-arm64

Returns an iterator on all keys.

 

property Keys: IEnumerable<T> read;

 

IEnumerable<T> Keys { get; }

 

var Keys: IEnumerable<T> { get{} }

 

IEnumerable<T> Keys { __get; }

Values watchOS-arm64

Returns an iterator on all values.

 

property Values: IEnumerable<U> read;

 

IEnumerable<U> Values { get; }

 

var Values: IEnumerable<U> { get{} }

 

IEnumerable<U> Values { __get; }

 

ReferenceEquals    (declared in Object)

Compares two references for equivalence (even if they have an equals operator)

 

class method ReferenceEquals(a: Object; b: Object): Boolean

 

static Boolean ReferenceEquals(Object a, Object b)

 

static func ReferenceEquals(_ a: Object, _ b: Object) -> Boolean

 

static Boolean ReferenceEquals(Object a, Object b)

Parameters:

  • a: left value
  • b: right value

 

constructor    (declared in Object)

Default constructor.

 

constructor

 

Dictionary<T,U>()

 

init()

 

Dictionary<T,U>()

constructor (IEqualityComparer<T>) watchOS-arm64

Constructor with non default equality comparer.

 

constructor(aComparer: IEqualityComparer<T>)

 

Dictionary<T,U>(IEqualityComparer<T> aComparer)

 

init(_ aComparer: IEqualityComparer<T>)

 

Dictionary<T,U>(IEqualityComparer<T> aComparer)

Parameters:

  • aComparer: The comparer to use.

constructor (Int32)

Constructor with capacity.

 

constructor(aCapacity: Int32)

 

Dictionary<T,U>(Int32 aCapacity)

 

init(_ aCapacity: Int32)

 

Dictionary<T,U>(Int32 aCapacity)

Parameters:

  • aCapacity: The initial capacity.

constructor (Int32, IEqualityComparer<T>) watchOS-arm64

Constructor with non default equality comparer and initial capacity.

 

constructor(aCapacity: Int32; aComparer: IEqualityComparer<T>)

 

Dictionary<T,U>(Int32 aCapacity, IEqualityComparer<T> aComparer)

 

init(_ aCapacity: Int32, _ aComparer: IEqualityComparer<T>)

 

Dictionary<T,U>(Int32 aCapacity, IEqualityComparer<T> aComparer)

Parameters:

  • aCapacity: The initial capacity.
  • aComparer: The comparer to use.

Add

Adds an item to the dictionary; Fails if Key is already present.

 

method Add(Key: T; Value: U)

 

void Add(T Key, U Value)

 

func Add(_ Key: T, _ Value: U)

 

void Add(T Key, U Value)

Parameters:

  • Key: The key for this item
  • Value: The value for this item

Clear

Clears all items from this dictionary.

 

method Clear

 

void Clear()

 

func Clear()

 

void Clear()

ContainsKey watchOS-arm64

Returns true if the dictionary contains this key.

 

method ContainsKey(Key: T): Boolean

 

Boolean ContainsKey(T Key)

 

func ContainsKey(_ Key: T) -> Boolean

 

Boolean ContainsKey(T Key)

Parameters:

  • Key: The key to find

ContainsValue watchOS-arm64

Iterators the dictionary and checks if it contains this value.

 

method ContainsValue(Value: U): Boolean

 

Boolean ContainsValue(U Value)

 

func ContainsValue(_ Value: U) -> Boolean

 

Boolean ContainsValue(U Value)

Parameters:

  • Value: The value to find.

Equals  virtual    (declared in Object)

Returns true if the target object matches this one, by default compares the reference.

 

method Equals(obj: Object): Boolean

 

Boolean Equals(Object obj)

 

func Equals(_ obj: Object) -> Boolean

 

Boolean Equals(Object obj)

Parameters:

  • obj: the reference to compare this with.

Finalize  protected virtual    (declared in Object)

Finalizer implementation. If not overriden it's not called at all, the runtime checks if there is an override before calling a finalizer.

 

method Finalize

 

void Finalize()

 

func Finalize()

 

void Finalize()

ForEach watchOS-arm64

Iterates this dictionary and triggers the action for every item.

 

method ForEach(Action: Action<KeyValuePair<T, U>>)

 

void ForEach(Action<KeyValuePair<T, U>> Action)

 

func ForEach(_ Action: Action<KeyValuePair<T, U>>)

 

void ForEach(Action1<KeyValuePair<T, U>> Action)

Parameters:

  • Action: Action to run.

GetEnumerator  virtual    (declared in ImmutableDictionary<T,U>) Android, iOS, iOS Simulator, macOS, tvOS, tvOS Simulator, Ubuntu, UIKit for Mac, watchOS Simulator, watchOS-arm64_32, watchOS-armv7k, WebAssembly, Windows

Iterator.

 

method GetEnumerator: IEnumerator<KeyValuePair<T, U>>

 

IEnumerator<KeyValuePair<T, U>> GetEnumerator()

 

func GetEnumerator() -> IEnumerator<KeyValuePair<T, U>>

 

IEnumerator<KeyValuePair<T, U>> GetEnumerator()

GetHashCode  virtual    (declared in Object)

Returns a hashcode for this object. Overriden implementations should make sure that the number returned here is constant given the same object.

 

method GetHashCode: Int32

 

Int32 GetHashCode()

 

func GetHashCode() -> Int32

 

Int32 GetHashCode()

GetSequence watchOS-arm64

Iterator implementation for this dictionary.

 

method GetSequence: IEnumerable<KeyValuePair<T,U>>

 

IEnumerable<KeyValuePair<T,U>> GetSequence()

 

func GetSequence() -> IEnumerable<KeyValuePair<T,U>>

 

IEnumerable<KeyValuePair<T,U>> GetSequence()

GetType    (declared in Object)

Returns the actual type of this class

 

method GetType: Type

 

Type GetType()

 

func GetType() -> Type

 

Type GetType()

Remove

Removes an item from the dictionary, returns true if it was there.

 

method Remove(Key: T): Boolean

 

Boolean Remove(T Key)

 

func Remove(_ Key: T) -> Boolean

 

Boolean Remove(T Key)

Parameters:

  • Key: The key to remove.

ToNSDictionary watchOS-arm64

Explicit operator to cast to NSMutableDictionary.

 

method ToNSDictionary: NSDictionary<T, U>

 

NSDictionary<T, U> ToNSDictionary()

 

func ToNSDictionary() -> NSDictionary<T, U>

 

NSDictionary<T, U> ToNSDictionary()

ToNSMutableDictionary watchOS-arm64

Explicit operator to cast to NSMutableDictionary.

 

method ToNSMutableDictionary: NSMutableDictionary<T, U>

 

NSMutableDictionary<T, U> ToNSMutableDictionary()

 

func ToNSMutableDictionary() -> NSMutableDictionary<T, U>

 

NSMutableDictionary<T, U> ToNSMutableDictionary()

ToString  virtual    (declared in Object)

Gets the string representation of this method.

 

method ToString: String

 

String ToString()

 

func ToString() -> String

 

String ToString()

TryGetValue watchOS-arm64

Returns a value for a given key into aValue, and returns if it was present or not.

 

method TryGetValue(aKey: T; out aValue: U): Boolean

 

Boolean TryGetValue(T aKey, out U aValue)

 

func TryGetValue(_ aKey: T, _ aValue: U) -> Boolean

 

Boolean TryGetValue(T aKey, __out U aValue)

Parameters:

  • aKey: Key to find
  • aValue: The resulting value.