Table of Contents

Class ResultWithException<T>

Namespace
SunamoResult
Assembly
SunamoResult.dll

Wraps a result value or an exception message, enabling async-compatible error handling without ref/out parameters.

public class ResultWithException<T>

Type Parameters

T

The type of the result data.

Inheritance
ResultWithException<T>
Inherited Members
Extension Methods

Constructors

ResultWithException()

Initializes a new empty instance, used when the data type is string and could be confused with an exception message.

public ResultWithException()

ResultWithException(Exception)

Initializes a new instance with the message extracted from the specified exception.

public ResultWithException(Exception exception)

Parameters

exception Exception

The exception whose message will be stored.

ResultWithException(string)

Initializes a new instance with the specified exception message.

public ResultWithException(string exceptionMessage)

Parameters

exceptionMessage string

The exception message string.

ResultWithException(T)

Initializes a new instance with the specified result data.

public ResultWithException(T data)

Parameters

data T

The result data to store.

Properties

Data

Gets or sets the result data.

public T? Data { get; set; }

Property Value

T

ExceptionMessage

Gets or sets the exception message as string, because the Message property of Exception is not editable after instantiation.

public string? ExceptionMessage { get; set; }

Property Value

string