Table of Contents

Class HybridCollection<T>

Namespace
Balsam.Utility
Assembly
Balsam.Backtester.dll

An abstract collection for accessing items by key or index.

public abstract class HybridCollection<T> : ICollection<T>, IEnumerable<T>, IEnumerable, INotifyCollectionChanged

Type Parameters

T
Inheritance
HybridCollection<T>
Implements
Inherited Members
Extension Methods

Constructors

HybridCollection()

Initializes an empty collection.

protected HybridCollection()

HybridCollection(int)

Initializes a collection with the specified capacity.

protected HybridCollection(int capacity)

Parameters

capacity int

Properties

Count

Gets the number of elements in the collection.

public int Count { get; }

Property Value

int

IsReadOnly

Gets/sets whether the collection is read-only.

public bool IsReadOnly { get; protected set; }

Property Value

bool

this[int]

Gets/sets an element by index.

public T this[int index] { get; set; }

Parameters

index int

Property Value

T

this[string]

Gets/sets an element by key.

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

Parameters

key string

Property Value

T

Methods

Contains(T)

Determines whether the specified element is in the collection.

public bool Contains(T item)

Parameters

item T

Returns

bool

ContainsKey(string)

Returns true if the collection contains the specified key.

public bool ContainsKey(string key)

Parameters

key string

Returns

bool

GetEnumerator()

Returns an enumerator that iterates through the collection.

public IEnumerator<T> GetEnumerator()

Returns

IEnumerator<T>

GetKeys()

Returns an enumerable of keys.

public IEnumerable<string> GetKeys()

Returns

IEnumerable<string>

OnAdd(string, T)

Adds the specified key/value pair.

protected void OnAdd(string key, T item)

Parameters

key string
item T

OnClear()

Removes all elements from the collection.

protected void OnClear()

OnCollectionChanged(NotifyCollectionChangedEventArgs)

Raises a NotifyCollectionChanged event.

protected virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs e)

Parameters

e NotifyCollectionChangedEventArgs

OnCopyTo(T[], int)

Copies the collection to the specified array

protected void OnCopyTo(T[] array, int arrayIndex)

Parameters

array T[]
arrayIndex int

OnGetItem(string)

Gets the item using the specified key.

protected virtual T OnGetItem(string key)

Parameters

key string

Returns

T

OnRemove(string)

Removes the value with the specified key from the collection.

protected bool OnRemove(string key)

Parameters

key string

Returns

bool

OnRemove(T)

Removes the specified value and associated key.

protected bool OnRemove(T item)

Parameters

item T

Returns

bool

OnRemoveAt(int)

Removes the value at the specified index.

protected bool OnRemoveAt(int index)

Parameters

index int

Returns

bool

ToDictionary()

Converts the collection to a dictionary.

protected Dictionary<string, T> ToDictionary()

Returns

Dictionary<string, T>

ToString()

Returns a string representation of this collection.

public override string ToString()

Returns

string

Events

CollectionChanged

Raises an event when the collection is changed.

public event NotifyCollectionChangedEventHandler CollectionChanged

Event Type

NotifyCollectionChangedEventHandler