TemmlMacroDictionary
Namespace: Temml
public sealed class TemmlMacroDictionary : IDictionary<string, TemmlMacro?>, ICollection<KeyValuePair<string, TemmlMacro?>>, IReadOnlyDictionary<string, TemmlMacro?>, IReadOnlyCollection<KeyValuePair<string, TemmlMacro?>>, IEnumerable<KeyValuePair<string, TemmlMacro?>>, IEnumerableMacro name to definition, in insertion order. Maps to upstream’s prototype-less macros objects. A name may be present with a null value, which is upstream’s explicit undefined. An instance passed in TemmlOptions.Macros is written to by definitions such as \gdef, so do not share one between threads.
Inheritance: object
Implements: IDictionary<string, TemmlMacro>, ICollection<KeyValuePair<string, TemmlMacro>>, IReadOnlyDictionary<string, TemmlMacro>, IReadOnlyCollection<KeyValuePair<string, TemmlMacro>>, IEnumerable<KeyValuePair<string, TemmlMacro>>, IEnumerable
Properties
Section titled “Properties”public int Count { get; }Gets the number of elements contained in the ICollection%601.
Value: int — The number of elements contained in the ICollection%601.
this[string]
Section titled “this[string]”public TemmlMacro? this[string key] { get; set; }Gets or sets a definition. Reading a name that is not present returns null.
Parameters
| Name | Type | Description |
|---|---|---|
key |
string |
Value: TemmlMacro
public ICollection<string> Keys { get; }Gets an ICollection%601 containing the keys of the IDictionary%602.
Value: ICollection<string> — An ICollection%601 containing the keys of the object that implements IDictionary%602.
Values
Section titled “Values”public ICollection<TemmlMacro?> Values { get; }Gets an ICollection%601 containing the values in the IDictionary%602.
Value: ICollection<TemmlMacro> — An ICollection%601 containing the values in the object that implements IDictionary%602.
Methods
Section titled “Methods”Add(string, TemmlMacro?)
Section titled “Add(string, TemmlMacro?)”public void Add(string key, TemmlMacro? value)Adds an element with the provided key and value to the IDictionary%602.
Parameters
| Name | Type | Description |
|---|---|---|
key |
string | The object to use as the key of the element to add. |
value |
TemmlMacro | The object to use as the value of the element to add. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | <code class=“paramref”>key</code> is <a href=“https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null">null</a>. |
| ArgumentException | An element with the same key already exists in the IDictionary%602. |
| NotSupportedException | The IDictionary%602 is read-only. |
Clear()
Section titled “Clear()”public void Clear()Removes all items from the ICollection%601.
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | The ICollection%601 is read-only. |
ContainsKey(string)
Section titled “ContainsKey(string)”public bool ContainsKey(string key)Determines whether the IDictionary%602 contains an element with the specified key.
Parameters
| Name | Type | Description |
|---|---|---|
key |
string | The key to locate in the IDictionary%602. |
Returns: bool — <a href=“https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">true</a> if the IDictionary%602 contains an element with the key; otherwise, <a href=“https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">false</a>.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | <code class=“paramref”>key</code> is <a href=“https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null">null</a>. |
GetEnumerator()
Section titled “GetEnumerator()”public IEnumerator<KeyValuePair<string, TemmlMacro?>> GetEnumerator()Returns an enumerator that iterates through the collection.
Returns: IEnumerator<KeyValuePair<string, TemmlMacro>> — An enumerator that can be used to iterate through the collection.
Remove(string)
Section titled “Remove(string)”public bool Remove(string key)Removes the element with the specified key from the IDictionary%602.
Parameters
| Name | Type | Description |
|---|---|---|
key |
string | The key of the element to remove. |
Returns: bool — <a href=“https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">true</a> if the element is successfully removed; otherwise, <a href=“https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">false</a>. This method also returns <a href=“https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">false</a> if <code class=“paramref”>key</code> was not found in the original IDictionary%602.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | <code class=“paramref”>key</code> is <a href=“https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null">null</a>. |
| NotSupportedException | The IDictionary%602 is read-only. |
TryGetValue(string, out TemmlMacro?)
Section titled “TryGetValue(string, out TemmlMacro?)”public bool TryGetValue(string key, out TemmlMacro? value)Gets the value associated with the specified key.
Parameters
| Name | Type | Description |
|---|---|---|
key |
string | The key whose value to get. |
value |
TemmlMacro | 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 <code class=“paramref”>value</code> parameter. This parameter is passed uninitialized. |
Returns: bool — <a href=“https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">true</a> if the object that implements IDictionary%602 contains an element with the specified key; otherwise, <a href=“https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">false</a>.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | <code class=“paramref”>key</code> is <a href=“https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null">null</a>. |
MIT · Copyright 2020 Ron Kok · unofficial community port of Temml