Class LineGraph<TNumber>
Implements
Inherited Members
Namespace: Ritchie.Toolbox.Core
Assembly: Ritchie.Toolbox.dll
Syntax
public class LineGraph<TNumber> : IDictionary<TNumber, TNumber>, ICollection<KeyValuePair<TNumber, TNumber>>, IEnumerable<KeyValuePair<TNumber, TNumber>>, IEnumerable where TNumber : INumber<TNumber>
Type Parameters
Name | Description |
---|---|
TNumber |
Properties
Count
Gets the number of elements contained in the ICollection<T>.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
int | The number of elements contained in the ICollection<T>. |
IsReadOnly
Gets a value indicating whether the ICollection<T> is read-only.
Declaration
public bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
bool | true if the ICollection<T> is read-only; otherwise, false. |
this[TNumber]
Gets or sets the element with the specified key.
Declaration
public TNumber this[TNumber key] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
TNumber | key | The key of the element to get or set. |
Property Value
Type | Description |
---|---|
TNumber | The element with the specified key. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
KeyNotFoundException | The property is retrieved and |
NotSupportedException | The property is set and the IDictionary<TKey, TValue> is read-only. |
Keys
Gets an ICollection<T> containing the keys of the IDictionary<TKey, TValue>.
Declaration
public ICollection<TNumber> Keys { get; }
Property Value
Type | Description |
---|---|
ICollection<TNumber> | An ICollection<T> containing the keys of the object that implements IDictionary<TKey, TValue>. |
Values
Gets an ICollection<T> containing the values in the IDictionary<TKey, TValue>.
Declaration
public ICollection<TNumber> Values { get; }
Property Value
Type | Description |
---|---|
ICollection<TNumber> | An ICollection<T> containing the values in the object that implements IDictionary<TKey, TValue>. |
Methods
Add(KeyValuePair<TNumber, TNumber>)
Adds an item to the ICollection<T>.
Declaration
public void Add(KeyValuePair<TNumber, TNumber> item)
Parameters
Type | Name | Description |
---|---|---|
KeyValuePair<TNumber, TNumber> | item | The object to add to the ICollection<T>. |
Exceptions
Type | Condition |
---|---|
NotSupportedException | The ICollection<T> is read-only. |
Add(TNumber, TNumber)
Adds an element with the provided key and value to the IDictionary<TKey, TValue>.
Declaration
public void Add(TNumber key, TNumber value)
Parameters
Type | Name | Description |
---|---|---|
TNumber | key | The object to use as the key of the element to add. |
TNumber | value | The object to use as the value of the element to add. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ArgumentException | An element with the same key already exists in the IDictionary<TKey, TValue>. |
NotSupportedException | The IDictionary<TKey, TValue> is read-only. |
Clear()
Removes all items from the ICollection<T>.
Declaration
public void Clear()
Exceptions
Type | Condition |
---|---|
NotSupportedException | The ICollection<T> is read-only. |
Contains(KeyValuePair<TNumber, TNumber>)
Determines whether the ICollection<T> contains a specific value.
Declaration
public bool Contains(KeyValuePair<TNumber, TNumber> item)
Parameters
Type | Name | Description |
---|---|---|
KeyValuePair<TNumber, TNumber> | item | The object to locate in the ICollection<T>. |
Returns
Type | Description |
---|---|
bool | true if |
ContainsKey(TNumber)
Determines whether the IDictionary<TKey, TValue> contains an element with the specified key.
Declaration
public bool ContainsKey(TNumber key)
Parameters
Type | Name | Description |
---|---|---|
TNumber | key | The key to locate in the IDictionary<TKey, TValue>. |
Returns
Type | Description |
---|---|
bool | true if the IDictionary<TKey, TValue> contains an element with the key; otherwise, false. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
CopyTo(KeyValuePair<TNumber, TNumber>[], int)
Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.
Declaration
public void CopyTo(KeyValuePair<TNumber, TNumber>[] array, int arrayIndex)
Parameters
Type | Name | Description |
---|---|---|
KeyValuePair<TNumber, TNumber>[] | array | The one-dimensional Array that is the destination of the elements copied from ICollection<T>. The Array must have zero-based indexing. |
int | arrayIndex | The zero-based index in |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ArgumentOutOfRangeException |
|
ArgumentException | The number of elements in the source ICollection<T> is greater than the available space from |
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<KeyValuePair<TNumber, TNumber>> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<KeyValuePair<TNumber, TNumber>> | An enumerator that can be used to iterate through the collection. |
GetValueAtPosition(TNumber)
Declaration
public TNumber GetValueAtPosition(TNumber position)
Parameters
Type | Name | Description |
---|---|---|
TNumber | position |
Returns
Type | Description |
---|---|
TNumber |
GetValueBeforePosition(TNumber)
Declaration
public TNumber GetValueBeforePosition(TNumber position)
Parameters
Type | Name | Description |
---|---|---|
TNumber | position |
Returns
Type | Description |
---|---|
TNumber |
Remove(KeyValuePair<TNumber, TNumber>)
Removes the first occurrence of a specific object from the ICollection<T>.
Declaration
public bool Remove(KeyValuePair<TNumber, TNumber> item)
Parameters
Type | Name | Description |
---|---|---|
KeyValuePair<TNumber, TNumber> | item | The object to remove from the ICollection<T>. |
Returns
Type | Description |
---|---|
bool | true if |
Exceptions
Type | Condition |
---|---|
NotSupportedException | The ICollection<T> is read-only. |
Remove(TNumber)
Removes the element with the specified key from the IDictionary<TKey, TValue>.
Declaration
public bool Remove(TNumber key)
Parameters
Type | Name | Description |
---|---|---|
TNumber | key | The key of the element to remove. |
Returns
Type | Description |
---|---|
bool | true if the element is successfully removed; otherwise, false. This method also returns false if |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
NotSupportedException | The IDictionary<TKey, TValue> is read-only. |
SetValueAtPosition(TNumber, TNumber)
Declaration
public void SetValueAtPosition(TNumber position, TNumber value)
Parameters
Type | Name | Description |
---|---|---|
TNumber | position | |
TNumber | value |
TryGetValue(TNumber, out TNumber)
Gets the value associated with the specified key.
Declaration
public bool TryGetValue(TNumber key, out TNumber value)
Parameters
Type | Name | Description |
---|---|---|
TNumber | key | The key whose value to get. |
TNumber | value | When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the |
Returns
Type | Description |
---|---|
bool | true if the object that implements IDictionary<TKey, TValue> contains an element with the specified key; otherwise, false. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|