Class KeyValueList
Simple wrapper to replace Dictionary<string,string>
.
This helps limit the size of the values and convert to binary for the internal c/c++ API.
Inheritance
Namespace: Trail
Assembly: Trail.dll
Syntax
public class KeyValueList : IEnumerable<KeyValueList.KeyValue>
Constructors
KeyValueList()
Declaration
public KeyValueList()
KeyValueList(IDictionary<String, String>)
Declaration
public KeyValueList(IDictionary<string, string> otherKeyValueDictionary)
Parameters
Type | Name | Description |
---|---|---|
IDictionary<System.String, System.String> | otherKeyValueDictionary |
KeyValueList(IList<KeyValueList.KeyValue>)
Declaration
public KeyValueList(IList<KeyValueList.KeyValue> otherKeyValueList)
Parameters
Type | Name | Description |
---|---|---|
IList<KeyValueList.KeyValue> | otherKeyValueList |
KeyValueList(Int32)
Declaration
public KeyValueList(int size)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | size |
KeyValueList(String, String)
Declaration
public KeyValueList(string key, string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | |
System.String | value |
Fields
KEY_SIZE
Declaration
public const int KEY_SIZE = null
Field Value
Type | Description |
---|---|
System.Int32 |
VALUE_SIZE
Declaration
public const int VALUE_SIZE = null
Field Value
Type | Description |
---|---|
System.Int32 |
Properties
Count
Returns the amount of items this keyValueList have.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Item[Int32]
Declaration
public KeyValueList.KeyValue this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Property Value
Type | Description |
---|---|
KeyValueList.KeyValue |
Item[String]
Declaration
public string this[string key] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.String | key |
Property Value
Type | Description |
---|---|
System.String |
Length
Returns the amount of items this keyValueList have.
Declaration
public int Length { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
Add(String, String)
Adds a new item to the KeyValueList.
Declaration
public KeyValueList Add(string key, string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key for the item. |
System.String | value | The value for the item. |
Returns
Type | Description |
---|---|
KeyValueList | Returns itself for linking. .Add().Add() |
Add(KeyValueList.KeyValue)
Adds a new item to the KeyValueList.
Declaration
public KeyValueList Add(KeyValueList.KeyValue keyValue)
Parameters
Type | Name | Description |
---|---|---|
KeyValueList.KeyValue | keyValue | A keyvalue item to add to this KeyValueList. |
Returns
Type | Description |
---|---|
KeyValueList | Returns itself for linking. .Add().Add() |
Contains(String)
Checks whether it has an item with provided key.
Declaration
public bool Contains(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to check for. |
Returns
Type | Description |
---|---|
System.Boolean | Returns whether item exists with key. |
Has(String)
Checks whether it has an item with provided key.
Declaration
public bool Has(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to check for. |
Returns
Type | Description |
---|---|
System.Boolean | Returns whether item exists with key. |
Remove(String)
Removes an item from this KeyValueList.
Declaration
public bool Remove(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to look for and remove. |
Returns
Type | Description |
---|---|
System.Boolean | Whether it succeedes at removing an item from the KeyValueList. |
Remove(KeyValueList.KeyValue)
Removes an item from this KeyValueList.
Declaration
public bool Remove(KeyValueList.KeyValue keyValue)
Parameters
Type | Name | Description |
---|---|---|
KeyValueList.KeyValue | keyValue | The keyvalue container to get the key from to remove. |
Returns
Type | Description |
---|---|
System.Boolean | Whether it succeedes at removing an item from the KeyValueList. |
Set(String, String)
Sets the value of provided key.
Declaration
public void Set(string key, string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to apply new value to. |
System.String | value | The new value to apply |
Set(String, String, Boolean)
Sets the value of provided key.
Declaration
public void Set(string key, string value, bool addIfNotExist)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to apply new value to. |
System.String | value | The new value to apply |
System.Boolean | addIfNotExist | Whether to add new item if key does not exist. |