Table of Contents

Class EnumParser

Namespace
SampSharp.Entities.SAMP.Commands
Assembly
SampSharp.OpenMp.Entities.Commands.dll

Parses an enum by integer value or by (case-insensitive) substring of name.

public class EnumParser : ICommandParameterParser
Inheritance
EnumParser
Implements
Inherited Members

Constructors

EnumParser(Type)

Initializes a new instance.

public EnumParser(Type enumType)

Parameters

enumType Type

Exceptions

ArgumentException

If enumType is not an enum type.

Methods

TryParse(IServiceProvider, ref StringSpan, out object?)

Tries to parse the next token from inputText.

public bool TryParse(IServiceProvider services, ref StringSpan inputText, out object? result)

Parameters

services IServiceProvider

Service provider (used by parsers that need DI, e.g. PlayerParser).

inputText StringSpan

Remaining input text as a StringSpan. Consumed text is removed by advancing the span.

result object

Parsed value on success.

Returns

bool

true on success.