Skip to content

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?>>, IEnumerable

Macro 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

View source

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.

View source

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

View source

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.

View source

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.

View source

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"&gt;null&lt;/a>.
ArgumentException An element with the same key already exists in the IDictionary%602.
NotSupportedException The IDictionary%602 is read-only.

View source

public void Clear()

Removes all items from the ICollection%601.

Exceptions

Type Condition
NotSupportedException The ICollection%601 is read-only.

View source

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"&gt;true&lt;/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"&gt;false&lt;/a>.

Exceptions

Type Condition
ArgumentNullException <code class=“paramref”>key</code> is <a href=“https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null"&gt;null&lt;/a>.

View source

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.

View source

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"&gt;true&lt;/a> if the element is successfully removed; otherwise, <a href=“https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool"&gt;false&lt;/a>. This method also returns <a href=“https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool"&gt;false&lt;/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"&gt;null&lt;/a>.
NotSupportedException The IDictionary%602 is read-only.

View source

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"&gt;true&lt;/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"&gt;false&lt;/a>.

Exceptions

Type Condition
ArgumentNullException <code class=“paramref”>key</code> is <a href=“https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null"&gt;null&lt;/a>.

View source

MIT · Copyright 2020 Ron Kok · unofficial community port of Temml