Table of Contents

Class DictionaryToken

Namespace
UglyToad.PdfPig.Tokens
Assembly
UglyToad.PdfPig.Tokens.dll

A dictionary object is an associative table containing pairs of objects, known as the dictionary's entries. The key must be a NameToken and the value may be an kind of IToken.

public class DictionaryToken : IDataToken<IReadOnlyDictionary<string, IToken>>, IToken, IEquatable<IToken>, IEquatable<DictionaryToken>
Inheritance
DictionaryToken
Implements
Inherited Members

Constructors

DictionaryToken(IReadOnlyDictionary<NameToken, IToken>)

Create a new DictionaryToken.

public DictionaryToken(IReadOnlyDictionary<NameToken, IToken> data)

Parameters

data IReadOnlyDictionary<NameToken, IToken>

The data this dictionary will contain.

Properties

Data

The key value pairs in this dictionary.

public IReadOnlyDictionary<string, IToken> Data { get; }

Property Value

IReadOnlyDictionary<string, IToken>

Methods

ContainsKey(NameToken)

Whether the dictionary contains an entry with this name.

public bool ContainsKey(NameToken name)

Parameters

name NameToken

The name to check.

Returns

bool

true if the token is found, false otherwise.

Equals(DictionaryToken)

public bool Equals(DictionaryToken other)

Parameters

other DictionaryToken

Returns

bool

Equals(IToken)

public bool Equals(IToken obj)

Parameters

obj IToken

Returns

bool

ToString()

public override string ToString()

Returns

string

TryGet(NameToken, out IToken)

Try and get the entry with a given name.

public bool TryGet(NameToken name, out IToken token)

Parameters

name NameToken

The name of the entry to retrieve.

token IToken

The token, if it is found.

Returns

bool

true if the token is found, false otherwise.

TryGet<T>(NameToken, out T)

Try and get the entry with a given name and a specific data type.

public bool TryGet<T>(NameToken name, out T token) where T : IToken

Parameters

name NameToken

The name of the entry to retrieve.

token T

The token, if it is found.

Returns

bool

true if the token is found with this type, false otherwise.

Type Parameters

T

The expected data type of the dictionary value.

With(IReadOnlyDictionary<string, IToken>)

Create a new DictionaryToken.

public static DictionaryToken With(IReadOnlyDictionary<string, IToken> data)

Parameters

data IReadOnlyDictionary<string, IToken>

The data this dictionary will contain.

Returns

DictionaryToken

With(string, IToken)

Create a copy of this dictionary with the additional entry (or override the value of the existing entry).

public DictionaryToken With(string key, IToken value)

Parameters

key string

The key of the entry to create or override.

value IToken

The value of the entry to create or override.

Returns

DictionaryToken

A new DictionaryToken with the entry created or modified.

With(NameToken, IToken)

Create a copy of this dictionary with the additional entry (or override the value of the existing entry).

public DictionaryToken With(NameToken key, IToken value)

Parameters

key NameToken

The key of the entry to create or override.

value IToken

The value of the entry to create or override.

Returns

DictionaryToken

A new DictionaryToken with the entry created or modified.

Without(string)

Creates a copy of this dictionary with the entry with the specified key removed (if it exists).

public DictionaryToken Without(string key)

Parameters

key string

The key of the entry to remove.

Returns

DictionaryToken

A new DictionaryToken with the entry removed.

Without(NameToken)

Creates a copy of this dictionary with the entry with the specified key removed (if it exists).

public DictionaryToken Without(NameToken key)

Parameters

key NameToken

The key of the entry to remove.

Returns

DictionaryToken

A new DictionaryToken with the entry removed.