Class Result<T>
- Namespace
- Htmx.Components.Models
- Assembly
- Htmx.Components.dll
Represents the result of an operation that returns a value, with optional success/error status and message. This generic result type extends the base Result class to include a typed value.
public class Result<T> : Result
Type Parameters
T
The type of the value returned by the operation
- Inheritance
-
Result<T>
- Inherited Members
- Extension Methods
Constructors
Result(T, string)
Initializes a new instance of the Result class with the specified value and optional message.
public Result(T value, string message = "")
Parameters
value
TThe value returned by the operation
message
stringAn optional message describing the result
Properties
Value
Gets the value returned by the operation. This value may be null or default if the operation failed.
public T Value { get; }
Property Value
- T
Operators
implicit operator Result<T>(ResultError)
Implicitly converts a ResultError to a failed Result<T>. This allows for easy creation of error results without explicitly constructing the Result<T> instance.
public static implicit operator Result<T>(Result.ResultError error)
Parameters
error
Result.ResultErrorThe error information to convert to a failed result
Returns
- Result<T>
A failed Result<T> with the error message