Class ResultInfo<T>
Record to contain both whether the task was a success and the resulting data
Implements
IEquatable<ResultInfo<T>>
Inherited Members
Namespace: DevToys.Api
Assembly: DevToys.Api.dll
Syntax
public record ResultInfo<T> : IEquatable<ResultInfo<T>>
Type Parameters
Name | Description |
---|---|
T | Type of the result |
Constructors
ResultInfo(T, bool)
Record to contain both whether the task was a success and the resulting data
Declaration
public ResultInfo(T data, bool hasSucceeded = true)
Parameters
Type | Name | Description |
---|---|---|
T | data | The resulting data or the task |
bool | hasSucceeded | Whether the task succeeded |
ResultInfo(T, string, bool)
Record to contain both whether the task was a success and the resulting data
Declaration
public ResultInfo(T data, string errorMessage, bool hasSucceeded = false)
Parameters
Type | Name | Description |
---|---|---|
T | data | The resulting data or the task |
string | errorMessage | The error message |
bool | hasSucceeded | Whether the task succeeded |
Properties
Data
The resulting data or the task
Declaration
public T? Data { get; }
Property Value
Type | Description |
---|---|
T |
ErrorMessage
Error message to display
Declaration
public string? ErrorMessage { get; }
Property Value
Type | Description |
---|---|
string |
HasSucceeded
Whether the task succeeded
Declaration
public bool HasSucceeded { get; }
Property Value
Type | Description |
---|---|
bool |