Table of Contents

Class Dictionary<T>

Namespace
PolarStudioGlobals
Assembly
PolarStudioGlobals.dll

The dictionary contains an unordered set of name-value pairs.

public class Dictionary<T>

Type Parameters

T
Inheritance
Dictionary<T>
Derived
Inherited Members
Extension Methods

Constructors

Dictionary()

public Dictionary()

Dictionary(CompareMode)

Creates a new dictionary and specified the compare mode.

public Dictionary(CompareMode pCompareMode)

Parameters

pCompareMode CompareMode

The compare mode to use (CompareMode.Text or CompareMode.Binary)

Properties

CompareMode

Gets/sets the compare mode.

public CompareMode CompareMode { get; set; }

Property Value

CompareMode

Count

Returns the number of elements in this dictionary.

public int Count { get; }

Property Value

int

this[string]

Gets an element in this dictionary. If not yet existing, a new element is created.

public T this[string Key] { get; set; }

Parameters

Key string

The key of the element to get.

Property Value

T

The found or new element

Items

Returns a list of objects with the elements in this dictionary.

public List<T> Items { get; }

Property Value

List<T>

Keys

Returns a list of strings with the keys in the dictionary.

public List<string> Keys { get; }

Property Value

List<string>

Methods

Add(string, T)

Adds or replaces an element to/in this dictionary.

public Dictionary<T> Add(string Key, T Item)

Parameters

Key string

The key for the new element.

Item T

The element to set.

Returns

Dictionary<T>

This dictionary.

Clear()

Removes all elements from the dictionary.

public void Clear()

ContainsKey(string)

Returns if the specified key exists in the dictionary.

public bool ContainsKey(string Key)

Parameters

Key string

The key to search for.

Returns

bool

True if the key was found.

Exists(string)

Returns if the specified key exists in the dictionary.

public bool Exists(string Key)

Parameters

Key string

The key to search for.

Returns

bool

True if the key was found.

GetJSON()

Returns the JSON for this dictionary.

public string GetJSON()

Returns

string

Remove(string)

Removes the element with the specified Key.

public Dictionary<T> Remove(string Key)

Parameters

Key string

The key of the element to remove.

Returns

Dictionary<T>

This dictionary.

RemoveAll()

Removes all elements from the dictionary.

public Dictionary<T> RemoveAll()

Returns

Dictionary<T>

This dictionary.

TryGet(string, T)

Tries to get an element in this dictionary. If not existing, returns the specified DefaultValue.

public T TryGet(string Key, T pDefaultValue = default)

Parameters

Key string

The key of the element to get.

pDefaultValue T

The value to use if the key is not found.

Returns

T

The found or DefaultValue element