Struct ValueParseResult

Represents the outcome of a value parser.

Implements
IEquatable<ValueParseResult>
Inherited Members
ValueType.Equals(object)
ValueType.GetHashCode()
ValueType.ToString()
object.GetType()
object.Equals(object, object)
object.ReferenceEquals(object, object)
Namespace: NanoRoute
Assembly: NanoRoute.dll
Syntax
public readonly struct ValueParseResult : IEquatable<ValueParseResult>
Examples
return new ValueParseResult(true, parsedValue);

Constructors

ValueParseResult(bool, object?)

Represents the outcome of a value parser.

Declaration
public ValueParseResult(bool Success, object? Parsed)
Parameters
Type Name Description
bool Success

true when the segment is accepted by the parser; otherwise false.

object Parsed

The parsed value when Success is true; otherwise null.

Examples
return new ValueParseResult(true, parsedValue);

Properties

False

Gets a failed parser result with Success set to false and Parsed set to null.

Declaration
public static ValueParseResult False { get; }
Property Value
Type Description
ValueParseResult
Remarks

Return this value when the current route branch should be treated as a non-match.

Examples
if (!Guid.TryParse(context.Segment.ToString(), out Guid id))
    return ValueParseResult.False;

return new ValueParseResult(true, id);

Parsed

The parsed value when Success is true; otherwise null.

Declaration
public object? Parsed { get; init; }
Property Value
Type Description
object

Success

true when the segment is accepted by the parser; otherwise false.

Declaration
public bool Success { get; init; }
Property Value
Type Description
bool

Implements

IEquatable<T>
In this article
Back to top Generated by DocFX