Table of Contents

Class NumericParser

Namespace
MRX.Parsing.Reflection
Assembly
MRX.Parsing.Reflection.dll

Default INumericParser implementation that parses tokens via reflection over types implementing INumber<TSelf>.

public class NumericParser : INumericParser
Inheritance
NumericParser
Implements
Inherited Members

Methods

Parse(Type, string, IFormatProvider?)

Parses token into a value of numericType.

public object Parse(Type numericType, string token, IFormatProvider? provider = null)

Parameters

numericType Type

The numeric type to parse the token into. Must implement INumber<TSelf>.

token string

The string representation of the value to parse.

provider IFormatProvider

An optional format provider used to interpret token.

Returns

object

The parsed value, boxed as object.

Exceptions

ArgumentNullException

numericType or token is null.

InvalidOperationException

numericType does not implement INumber<TSelf>.