Show / Hide Table of Contents

Class ParserFactory

Provides access to factory methods that are tailored for parsing operations adhering IParser and IConfigurableParser<TOptions>.

Inheritance
Object
ParserFactory
Namespace: Cuemon.Text
Assembly: Cuemon.Core.dll
Syntax
public static class ParserFactory

Methods

| Improve this Doc View Source

CreateConfigurableParser<TOptions>(Func<String, Type, Action<TOptions>, Object>)

Creates an IConfigurableParser<TOptions> implementation from the specified parser.

Declaration
public static IConfigurableParser<TOptions> CreateConfigurableParser<TOptions>(Func<string, Type, Action<TOptions>, object> parser)

    where TOptions : class, IParameterObject, new()
Parameters
Type Name Description
Func<String, Type, Action<TOptions>, Object> parser

The function delegate that does the actual parsing of a String.

Returns
Type Description
IConfigurableParser<TOptions>

An IConfigurableParser<TOptions> implementation.

Type Parameters
Name Description
TOptions

The type of the delegate setup.

| Improve this Doc View Source

CreateConfigurableParser<TResult, TOptions>(Func<String, Action<TOptions>, TResult>)

Creates an IConfigurableParser<TResult, TOptions> implementation from the specified parser.

Declaration
public static IConfigurableParser<TResult, TOptions> CreateConfigurableParser<TResult, TOptions>(Func<string, Action<TOptions>, TResult> parser)

    where TOptions : class, IParameterObject, new()
Parameters
Type Name Description
Func<String, Action<TOptions>, TResult> parser

The function delegate that does the actual parsing of a String.

Returns
Type Description
IConfigurableParser<TResult, TOptions>

An IConfigurableParser<TResult, TOptions> implementation.

Type Parameters
Name Description
TResult

The type of the converted result.

TOptions

The type of the delegate setup.

| Improve this Doc View Source

CreateParser(Func<String, Type, Object>)

Creates an IParser implementation from the specified parser.

Declaration
public static IParser CreateParser(Func<string, Type, object> parser)
Parameters
Type Name Description
Func<String, Type, Object> parser

The function delegate that does the actual parsing of a String.

Returns
Type Description
IParser

An IParser implementation.

| Improve this Doc View Source

CreateParser<TResult>(Func<String, TResult>)

Creates an IParser<TResult> implementation from the specified parser.

Declaration
public static IParser<TResult> CreateParser<TResult>(Func<string, TResult> parser)
Parameters
Type Name Description
Func<String, TResult> parser

The function delegate that does the actual parsing of a String.

Returns
Type Description
IParser<TResult>

An IParser<TResult> implementation.

Type Parameters
Name Description
TResult

The type of the converted result.

| Improve this Doc View Source

FromBase64()

Creates a parser that converts a String, represented in base-64 digits, to its equivalent byte[].

Declaration
public static IParser<byte[]> FromBase64()
Returns
Type Description
IParser<Byte[]>

An IConfigurableParser{byte[]} implementation.

Exceptions
Type Condition
ArgumentNullException

String cannot be null.

FormatException

String consist of illegal base-64 digits.

| Improve this Doc View Source

FromBinaryDigits()

Creates a parser that converts a String, represented in binary digits, to its equivalent byte[].

Declaration
public static IParser<byte[]> FromBinaryDigits()
Returns
Type Description
IParser<Byte[]>

An IConfigurableParser{byte[]} implementation.

Exceptions
Type Condition
ArgumentNullException

String cannot be null.

ArgumentException

String cannot be empty or consist only of white-space characters.

FormatException

String must consist only of binary digits.

| Improve this Doc View Source

FromEnum()

Creates a parser that converts a String to its equivalent Enum.

Declaration
public static IConfigurableParser<EnumStringOptions> FromEnum()
Returns
Type Description
IConfigurableParser<EnumStringOptions>

An IConfigurableParser{EnumStringOptions} implementation.

Exceptions
Type Condition
ArgumentNullException

String cannot be null -or- Type cannot be null.

ArgumentException

String cannot be empty or consist only of white-space characters -or- Type does not represents an enumeration.

OverflowException

String is outside the range of the underlying type of Type.

InvalidOperationException

String is not type SByte, Int16, Int32, Int64, Byte, UInt16, UInt32, or UInt64, or String.

| Improve this Doc View Source

FromGuid()

Creates a parser that converts a String to its equivalent Guid.

Declaration
public static IConfigurableParser<Guid, GuidStringOptions> FromGuid()
Returns
Type Description
IConfigurableParser<Guid, GuidStringOptions>

An IConfigurableParser{Guid,GuidStringOptions} implementation.

Exceptions
Type Condition
ArgumentNullException

String cannot be null.

ArgumentException

String cannot be empty or consist only of white-space characters.

FormatException

String was not recognized to be a GUID.

See Also
Parse(String)
ParseExact(String, String)
| Improve this Doc View Source

FromHexadecimal()

Creates a parser that converts a String, represented in hexadecimal digits, to its equivalent byte[].

Declaration
public static IParser<byte[]> FromHexadecimal()
Returns
Type Description
IParser<Byte[]>

An IConfigurableParser{byte[]} implementation.

Exceptions
Type Condition
ArgumentNullException

String cannot be null.

ArgumentException

String must be hexadecimal.

| Improve this Doc View Source

FromObject()

Creates a parser that converts a String to an Object of a particular type.

Declaration
public static IConfigurableParser<ObjectFormattingOptions> FromObject()
Returns
Type Description
IConfigurableParser<ObjectFormattingOptions>

An IConfigurableParser{ObjectFormattingOptions} implementation.

Remarks

If the underlying IFormatProvider of FormatProvider is a CultureInfo, then this will be used in the conversion.

Exceptions
Type Condition
NotSupportedException

String cannot be converted to the specified Type.

| Improve this Doc View Source

FromProtocolRelativeUri()

Creates a parser that converts a String, represented as a protocol relative URL, to its equivalent Uri.

Declaration
public static IConfigurableParser<Uri, ProtocolRelativeUriStringOptions> FromProtocolRelativeUri()
Returns
Type Description
IConfigurableParser<Uri, ProtocolRelativeUriStringOptions>

An IConfigurableParser{Uri,UriStringOptions} implementation.

Exceptions
Type Condition
ArgumentNullException

String cannot be null.

ArgumentException

String cannot be empty or consist only of white-space characters.

| Improve this Doc View Source

FromUri()

Creates a parser that converts a String, represented as an URL, to its equivalent Uri.

Declaration
public static IConfigurableParser<Uri, UriStringOptions> FromUri()
Returns
Type Description
IConfigurableParser<Uri, UriStringOptions>

An IConfigurableParser{Uri,UriStringOptions} implementation.

Exceptions
Type Condition
ArgumentNullException

String cannot be null.

ArgumentException

String cannot be empty or consist only of white-space characters.

| Improve this Doc View Source

FromUriScheme()

Creates a parser that converts a String, represented as an URI scheme, to its equivalent UriScheme.

Declaration
public static IParser<UriScheme> FromUriScheme()
Returns
Type Description
IParser<UriScheme>

An IConfigurableParser{UriScheme} implementation.

Exceptions
Type Condition
ArgumentNullException

String cannot be null.

ArgumentException

String cannot be empty or consist only of white-space characters.

| Improve this Doc View Source

FromUrlEncodedBase64()

Creates a parser that converts a String, represented in URL-safe base-64 digits, to its equivalent byte[].

Declaration
public static IParser<byte[]> FromUrlEncodedBase64()
Returns
Type Description
IParser<Byte[]>

An IConfigurableParser{byte[]} implementation.

Exceptions
Type Condition
ArgumentNullException

String cannot be null.

ArgumentException

String cannot be empty or consist only of white-space characters.

FormatException

String consist of illegal base-64 digits.

| Improve this Doc View Source

FromValueType()

Creates a parser that converts a String, represented as a simple input type, to its equivalent Boolean, Byte, Int32, Int64, Double, Single, DateTime or Guid.

Declaration
public static IConfigurableParser<object, FormattingOptions<CultureInfo>> FromValueType()
Returns
Type Description
IConfigurableParser<Object, FormattingOptions<CultureInfo>>

An IConfigurableParser{object,FormattingOptions{CultureInfo}} implementation.

  • Improve this Doc
  • View Source
In This Article
Back to top Copyright 2008-2022 Geekle. All rights reserved. Code with passion and love; deploy with confidence. 👨‍💻️🔥❤️🚀😎
Generated by DocFX