Skip to content

ILWeaverResult Class

A result value sometimes returned by ILWeaver containing status on action through IsValid. If IsValid is false, FailureMessage has a value.

C#
public class ILWeaverResult

Inheritance object

Constructs a new ILWeaverResult for the select ILWeaver. If failureMessage is left null, the result is success; otherwise failure.

C#
public ILWeaverResult(ILWeaver weaver, Func<string>? failureMessage)

weaver ILWeaver
The ILWeaver who this result is connected to.

failureMessage Func<string>
A delegate returning the failure message if the result is a failure, or null if it was a success.

Returns the state of the result.

C#
[MemberNotNullWhen(false, "FailureMessage")]
public bool IsValid { get; }

A message containing the details of what went wrong if IsValid is false.

C#
public string? FailureMessage { get; }

Throws if the previous action was not successful.

For checking if the action was valid without throwing, see IsValid or Extract(out ILWeaverResult).

C#
public ILWeaver ThrowIfFailure()

ILWeaver
The ILWeaver.

ILWeaverResultException

Outputs this ILWeaverResult. This method exists to allow more fluent chaining of the ILWeaver methods.

C#
public ILWeaver Extract(out ILWeaverResult result)

result ILWeaverResult

ILWeaver
The ILWeaver.