Table of Contents

Struct ParserResult<T>

Namespace
Farkle
Assembly
Farkle.dll

Represents the result of a parsing operation. It contains a T in case of success or an object in case of failure.

public readonly struct ParserResult<T> : ISpanFormattable, IFormattable

Type Parameters

T

The type of values held by successful parser results.

Implements
Inherited Members

Properties

Error

The ParserResult<T>'s error value.

public object? Error { get; }

Property Value

object

An implementation-defined object that describes what went wrong with the parsing operation, or null if the parsing operation has succeeded.

IsError

Whether the ParserResult<T> represents failure.

public bool IsError { get; }

Property Value

bool
See Also

IsSuccess

Whether the ParserResult<T> represents success.

public bool IsSuccess { get; }

Property Value

bool
See Also

Value

The ParserResult<T>'s success value.

public T Value { get; }

Property Value

T

Exceptions

InvalidOperationException

IsSuccess is false.

Methods

ToString()

Converts the ParserResult<T>'s success or error value to a string.

public override string ToString()

Returns

string

ToString(string?, IFormatProvider?)

Converts the ParserResult<T>'s success or error value to a string.

public string ToString(string? format, IFormatProvider? formatProvider)

Parameters

format string

Ignored.

formatProvider IFormatProvider

The IFormatProvider to use to format the string.

Returns

string