Interface IResult<T>
- Namespace
- NuvTools.Common.ResultWrapper
- Assembly
- NuvTools.Common.dll
Defines the generic contract for an operation result that includes a data payload.
public interface IResult<out T> : IResult
Type Parameters
TThe type of the data returned by the operation.
- Inherited Members
- Extension Methods
Examples
Example usage:
IResult<UserDto> result = await _userService.GetUserByIdAsync(1);
if (result.Succeeded)
{
Console.WriteLine($"User: {result.Data!.Name}");
}
else
{
Console.WriteLine($"Error: {result.Message}");
}
Remarks
This interface extends IResult by including a strongly-typed
Data property.
It allows returning both status information and operation results
in a unified, consistent structure.
Properties
Data
The data returned by the operation, if applicable.
T? Data { get; }
Property Value
- T