Table of Contents

Interface ISunamoDictionary<T, U>

Namespace
SunamoInterfaces.Interfaces
Assembly
SunamoInterfaces.dll

Interface for custom dictionary implementation.

public interface ISunamoDictionary<T, U>

Type Parameters

T

The type of keys in the dictionary.

U

The type of values in the dictionary.

Extension Methods

Properties

Count

Gets the number of key/value pairs contained in the dictionary.

int Count { get; }

Property Value

int

IsReadOnly

Gets a value indicating whether the dictionary is read-only.

bool IsReadOnly { get; }

Property Value

bool

this[T]

Gets or sets the value associated with the specified key.

U this[T key] { get; set; }

Parameters

key T

The key of the value to get or set.

Property Value

U

The value associated with the specified key.

Keys

Gets a collection containing the keys.

ICollection<T> Keys { get; }

Property Value

ICollection<T>

Values

Gets a collection containing the values.

ICollection<U> Values { get; }

Property Value

ICollection<U>

Methods

Add(KeyValuePair<T, U>)

Adds the specified key/value pair to the dictionary.

void Add(KeyValuePair<T, U> pair)

Parameters

pair KeyValuePair<T, U>

The key/value pair to add.

Add(T, U)

Adds the specified key and value to the dictionary.

void Add(T key, U value)

Parameters

key T

The key of the element to add.

value U

The value of the element to add.

Clear()

Removes all keys and values from the dictionary.

void Clear()

Contains(KeyValuePair<T, U>)

Determines whether the dictionary contains the specified key/value pair.

bool Contains(KeyValuePair<T, U> pair)

Parameters

pair KeyValuePair<T, U>

The key/value pair to locate.

Returns

bool

True if found; otherwise, false.

ContainsKey(T)

Determines whether the dictionary contains the specified key.

bool ContainsKey(T key)

Parameters

key T

The key to locate.

Returns

bool

True if the key exists; otherwise, false.

CopyTo(KeyValuePair<T, U>[], int)

Copies the elements of the dictionary to an array, starting at the specified array index.

void CopyTo(KeyValuePair<T, U>[] array, int arrayIndex)

Parameters

array KeyValuePair<T, U>[]

The destination array.

arrayIndex int

The zero-based index in array at which copying begins.

GetEnumerator()

Returns an enumerator that iterates through the dictionary.

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

Returns

IEnumerator<KeyValuePair<T, U>>

An enumerator for the dictionary.

Remove(KeyValuePair<T, U>)

Removes the specified key/value pair from the dictionary.

bool Remove(KeyValuePair<T, U> pair)

Parameters

pair KeyValuePair<T, U>

The key/value pair to remove.

Returns

bool

True if the pair was removed; otherwise, false.

Remove(T)

Removes the value with the specified key from the dictionary.

bool Remove(T key)

Parameters

key T

The key of the element to remove.

Returns

bool

True if the element was removed; otherwise, false.

TryGetValue(T, out U)

Gets the value associated with the specified key.

bool TryGetValue(T key, out U value)

Parameters

key T

The key of the value to get.

value U

When this method returns, contains the value associated with the specified key, if the key is found.

Returns

bool

True if the key was found; otherwise, false.