KeyValue<T,U>

Overview

Represents a key/value pair. This class is used by the Dictionary<T,U> to represent stored data.

Use case

An instance of KeyValue<T,U> is returned by the dictionary when enumerating through values:

var Users := new Dictionary<Integer, String>;
Users.Add(1, "First");
Users.Add(2, "Second");
Users.Add(3, "Third");

Users.ForEach(item -> writeLn(Sugar.String.Format("Id: {0} Name: {1}", item.Key, item.Value)));

Output:

Id: 1 Name: First
Id: 2 Name: Second
Id: 3 Name: Third

Location

 

constructor

Creates a new instance of the class with specified parameters.

 

constructor(aKey: T; aValue: U)

 

KeyValue<T,U>(T aKey, U aValue)

 

init(_ aKey: T, _ aValue: U)

 

KeyValue<T,U>(T aKey, U aValue)

Parameters:

  • aKey: Object that represents a key in pair.
  • aValue: Object that represents a value in pair.

Equals    (declared in KeyValuePair<T,U>)

 

method Equals(Obj: Object): Boolean

 

Boolean Equals(Object Obj)

 

func Equals(_ Obj: Object) -> Boolean

 

Boolean Equals(Object Obj)

Parameters:

  • Obj:

GetHashCode    (declared in KeyValuePair<T,U>)

 

method GetHashCode: Int32

 

Int32 GetHashCode()

 

func GetHashCode() -> Int32

 

Int32 GetHashCode()

GetTuple    (declared in KeyValuePair<T,U>)

 

method GetTuple: tuple of (T, U)

 

(T, U) GetTuple()

 

func GetTuple() -> (T, U)

 

Tuple2<T, U> GetTuple()

Key    (declared in KeyValuePair<T,U>)

 

property Key: T read;

 

T Key { get; }

 

var Key: T { get{} }

 

T Key { __get; }

ToString    (declared in KeyValuePair<T,U>)

 

method ToString: String

 

String ToString()

 

func ToString() -> String

 

String ToString()

Value    (declared in KeyValuePair<T,U>)

 

property Value: U read;

 

U Value { get; }

 

var Value: U { get{} }

 

U Value { __get; }

 

Key    (declared in KeyValuePair<T,U>)

 

property Key: T read;

 

T Key { get; }

 

var Key: T { get{} }

 

T Key { __get; }

Value    (declared in KeyValuePair<T,U>)

 

property Value: U read;

 

U Value { get; }

 

var Value: U { get{} }

 

U Value { __get; }

 

constructor

Creates a new instance of the class with specified parameters.

 

constructor(aKey: T; aValue: U)

 

KeyValue<T,U>(T aKey, U aValue)

 

init(_ aKey: T, _ aValue: U)

 

KeyValue<T,U>(T aKey, U aValue)

Parameters:

  • aKey: Object that represents a key in pair.
  • aValue: Object that represents a value in pair.

Equals    (declared in KeyValuePair<T,U>)

 

method Equals(Obj: Object): Boolean

 

Boolean Equals(Object Obj)

 

func Equals(_ Obj: Object) -> Boolean

 

Boolean Equals(Object Obj)

Parameters:

  • Obj:

GetHashCode    (declared in KeyValuePair<T,U>)

 

method GetHashCode: Int32

 

Int32 GetHashCode()

 

func GetHashCode() -> Int32

 

Int32 GetHashCode()

GetTuple    (declared in KeyValuePair<T,U>)

 

method GetTuple: tuple of (T, U)

 

(T, U) GetTuple()

 

func GetTuple() -> (T, U)

 

Tuple2<T, U> GetTuple()

ToString    (declared in KeyValuePair<T,U>)

 

method ToString: String

 

String ToString()

 

func ToString() -> String

 

String ToString()