Class VariableDictionary
- Namespace
- Balsam
- Assembly
- Balsam.Backtester.dll
A dictionary of variables accessible by key or index.
public class VariableDictionary : IDictionary<string, object>, ICollection<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>, IEnumerable, ICloneable
- Inheritance
-
VariableDictionary
- Implements
- Inherited Members
- Extension Methods
Properties
Count
Gets the number of items in this variable dictionary.
public int Count { get; }
Property Value
this[int]
Gets/sets an element by index.
public object this[int index] { get; set; }
Parameters
index
int
Property Value
this[string]
Gets/sets an element by key.
public object this[string key] { get; set; }
Parameters
key
string
Property Value
Keys
Returns a collection containing all the keys.
public ICollection<string> Keys { get; }
Property Value
Values
Returns a collection containing all the values.
public ICollection<object> Values { get; }
Property Value
Methods
Add(KeyValuePair<string, object>)
Adds the specified KeyValuePair to the dictionary.
public void Add(KeyValuePair<string, object> item)
Parameters
item
KeyValuePair<string, object>
Add(string, object)
Adds the specified key and item to the dictionary.
public void Add(string key, object item)
Parameters
Clear()
Clears the dictionary.
public void Clear()
Clone()
Returns a copy of this variable dictionary.
public VariableDictionary Clone()
Returns
ContainsKey(string)
Returns true if the specified key is in the dictionary.
public bool ContainsKey(string key)
Parameters
key
string
Returns
GetEnumerator()
Returns an enumerator to iterate through the dictionary.
public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
Returns
GetValueAsBoolean(int)
Returns a boolean value at the specified index.
public bool GetValueAsBoolean(int index)
Parameters
index
int
Returns
GetValueAsBoolean(string)
Returns a boolean value using the specified key.
public bool GetValueAsBoolean(string key)
Parameters
key
string
Returns
GetValueAsDateTime(int)
Returns a DateTime value at the specified index.
public DateTime GetValueAsDateTime(int index)
Parameters
index
int
Returns
GetValueAsDateTime(string)
Returns a DateTime value using the specifie key.
public DateTime GetValueAsDateTime(string key)
Parameters
key
string
Returns
GetValueAsDouble(int)
Returns a double value at the specified index.
public double GetValueAsDouble(int index)
Parameters
index
int
Returns
GetValueAsDouble(string)
Returns a double value using the specified key.
public double GetValueAsDouble(string key)
Parameters
key
string
Returns
GetValueAsInt32(int)
Returns an integer value at the specified index.
public int GetValueAsInt32(int index)
Parameters
index
int
Returns
GetValueAsInt32(string)
Returns an integer value using the specified key.
public int GetValueAsInt32(string key)
Parameters
key
string
Returns
GetValueAsString(int)
Returns a string value at the specified index.
public string GetValueAsString(int index)
Parameters
index
int
Returns
GetValueAsString(string)
Returns a string value using the specified key.
public string GetValueAsString(string key)
Parameters
key
string
Returns
GetValueAsType<T>(int)
Returns an object cast to the specified type at the specified index.
public T GetValueAsType<T>(int index)
Parameters
index
int
Returns
- T
Type Parameters
T
GetValueAsType<T>(string)
Returns an object cast to the specified type using the specified key.
public T GetValueAsType<T>(string key)
Parameters
key
string
Returns
- T
Type Parameters
T
Load(string)
Loads a json text file representation.
public static VariableDictionary Load(string fileName)
Parameters
fileName
string
Returns
Merge(VariableDictionary, bool, bool)
Merges the specified variable dictionary with the existing one, optionally overwriting any existing keys.
public void Merge(VariableDictionary variableDictionary, bool overwrite = false, bool throwOnDuplicateKey = false)
Parameters
variableDictionary
VariableDictionaryoverwrite
boolthrowOnDuplicateKey
bool
Remove(string)
Removes the item with the specified key from the dictionary.
public bool Remove(string key)
Parameters
key
string
Returns
Save(string)
Saves this DataSource to a json text representation.
public void Save(string fileName)
Parameters
fileName
string
SetProperties(object)
Sets the properties of the specified target object to the values contained in this dictionary.
public void SetProperties(object target)
Parameters
target
object
ToString()
Returns a json-like string representation of this variable dictionary.
public override string ToString()