Table of Contents

Class TomlArray

Namespace
RStein.TOML
Assembly
RStein.TOML.dll

Represents a TOML array, which is an ordered collection of values.

public class TomlArray : TomlValue, IList<TomlToken>, ICollection<TomlToken>, IEnumerable<TomlToken>, IEnumerable
Inheritance
TomlArray
Implements
Derived
Inherited Members

Remarks

TomlArray implements IList<T> to provide list-like access to its elements. All elements in a TOML array are stored as TomlToken objects. Arrays can contain primitive values, nested tables, or other arrays.

Constructors

TomlArray()

Initializes a new instance of the TomlArray class with an anonymous name.

public TomlArray()

TomlArray(TomlKey)

Initializes a new instance of the TomlArray class with the specified key.

public TomlArray(TomlKey fullName)

Parameters

fullName TomlKey

The fully qualified key name for this array.

TomlArray(TomlKey, TomlTokenType)

Initializes a new instance of the TomlArray.

protected TomlArray(TomlKey fullName, TomlTokenType tomlTokenType)

Parameters

fullName TomlKey
tomlTokenType TomlTokenType

Properties

Count

Gets the number of elements in the array.

public int Count { get; }

Property Value

int

FullName

Gets the fully qualified key name for this array.

public TomlKey FullName { get; }

Property Value

TomlKey

IsReadOnly

Gets a value indicating whether the array is read-only. Always returns false.

public bool IsReadOnly { get; }

Property Value

bool

this[int]

Gets the TomlToken on index.

public override TomlToken this[int index] { get; set; }

Parameters

index int

Index of the requested TomlToken.

Property Value

TomlToken

TomlToken on index.

this[string]

Always throws InvalidOperationException because TomlArray does not support access by the key.

public override TomlToken this[string key] { get; set; }

Parameters

key string

Property Value

TomlToken

Name

Gets the simple name of this array (last part of the fully qualified name).

public string Name { get; }

Property Value

string

Methods

Add(TomlArray)

Adds a TomlArray to the end of the array.

public void Add(TomlArray tomlArray)

Parameters

tomlArray TomlArray

The array to add.

Exceptions

ArgumentNullException

Thrown when tomlArray is null.

Add(TomlTable)

Adds a TomlTable to the end of the array.

public void Add(TomlTable tomlTable)

Parameters

tomlTable TomlTable

The table to add.

Exceptions

ArgumentNullException

Thrown when tomlTable is null.

Add(TomlToken)

Adds a TomlToken to the end of the array.

public void Add(TomlToken tomlValue)

Parameters

tomlValue TomlToken

The token to add.

Exceptions

ArgumentNullException

Thrown when tomlValue is null.

Add(bool)

Adds a boolean value to the end of the array.

public void Add(bool value)

Parameters

value bool

The boolean value.

Add(byte)

Adds an 8-bit unsigned integer value to the end of the array.

public void Add(byte value)

Parameters

value byte

The byte value.

Add(DateTime)

Adds a datetime value to the end of the array.

public void Add(DateTime value)

Parameters

value DateTime

The datetime value.

Add(decimal)

Adds a decimal value to the end of the array.

public void Add(decimal value)

Parameters

value decimal

The decimal value.

Add(double)

Adds a double-precision floating-point value to the end of the array.

public void Add(double value)

Parameters

value double

The double value.

Add(Guid)

Adds a GUID value to the end of the array (stored as a string).

public void Add(Guid value)

Parameters

value Guid

The GUID value.

Add(short)

Adds a 16-bit integer value to the end of the array.

public void Add(short value)

Parameters

value short

The short integer value.

Add(int)

Adds a 32-bit integer value to the end of the array.

public void Add(int value)

Parameters

value int

The integer value.

Add(long)

Adds a 64-bit integer value to the end of the array.

public void Add(long value)

Parameters

value long

The long integer value.

Add(sbyte)

Adds an 8-bit signed integer value to the end of the array.

public void Add(sbyte value)

Parameters

value sbyte

The signed byte value.

Add(float)

Adds a single-precision floating-point value to the end of the array.

public void Add(float value)

Parameters

value float

The float value.

Add(string)

Adds a string value to the end of the array.

public void Add(string value)

Parameters

value string

The string value.

Clear()

Removes all elements from the array.

public void Clear()

Contains(TomlToken)

Determines whether the array contains a specific element.

public bool Contains(TomlToken item)

Parameters

item TomlToken

The element to locate.

Returns

bool

true if the element is found; otherwise, false.

CopyTo(TomlToken[], int)

Copies the elements of the array to an array, starting at a specified array index.

public void CopyTo(TomlToken[] array, int arrayIndex)

Parameters

array TomlToken[]

The destination array.

arrayIndex int

The zero-based index in the destination array where copying begins.

GetChildren()

Enumerates all children of this TomlToken.

protected override IEnumerable<TomlToken> GetChildren()

Returns

IEnumerable<TomlToken>

IndexOf(TomlToken)

Determines the index of a specific element in the array.

public int IndexOf(TomlToken item)

Parameters

item TomlToken

The element to locate.

Returns

int

The index of the element, or -1 if not found.

Insert(int, TomlToken)

public void Insert(int index, TomlToken item)

Parameters

index int
item TomlToken

Remove(TomlToken)

Removes the first occurrence of a specific element from the array.

public bool Remove(TomlToken item)

Parameters

item TomlToken

The element to remove.

Returns

bool

true if the element was successfully removed; otherwise, false.

RemoveAt(int)

public void RemoveAt(int index)

Parameters

index int

ToString()

public override string ToString()

Returns

string