Struct ValueParseResult
Represents the outcome of a value parser.
Implements
Inherited Members
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 |
Examples
return new ValueParseResult(true, parsedValue);
Properties
False
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
Declaration
public object? Parsed { get; init; }
Property Value
| Type | Description |
|---|---|
| object |
Success
Declaration
public bool Success { get; init; }
Property Value
| Type | Description |
|---|---|
| bool |