Struct fsResult
The result of some sort of operation. A result is either successful or
not, but if it is successful then there may be a set of warnings/messages
associated with it. These warnings describe the performed error recovery
operations.
Syntax
Fields
Success
Declaration
public static fsResult Success
Field Value
Properties
AsException
Utility method to convert the result to an exception. This method is
only defined is Failed
returns true.
Declaration
public readonly Exception AsException { get; }
Property Value
Failed
Did this result fail? If so, you can see the reasons why in
RawMessages
.
Declaration
public readonly bool Failed { get; }
Property Value
Declaration
public readonly string FormattedMessages { get; }
Property Value
HasWarnings
Does this result have any warnings? This says nothing about if it
failed or succeeded, just if it has warning messages associated with
it.
Declaration
public readonly bool HasWarnings { get; }
Property Value
RawMessages
Declaration
public readonly IEnumerable<string> RawMessages { get; }
Property Value
Succeeded
Was the result a success? Note that even successful operations may
have warning messages (RawMessages
) associated with them.
Declaration
public readonly bool Succeeded { get; }
Property Value
Methods
AddMessage(String)
Adds a new message to this result.
Declaration
public void AddMessage(string message)
Parameters
Type |
Name |
Description |
String |
message |
|
AddMessages(fsResult)
Adds only the messages from the other result into this result,
ignoring the success/failure status of the other result.
Declaration
public void AddMessages(fsResult result)
Parameters
AssertSuccess()
A simply utility method that will assert that this result is
successful. If it is not, then an exception is thrown.
Declaration
public fsResult AssertSuccess()
Returns
AssertSuccessWithoutWarnings()
A simple utility method that will assert that this result is
successful and that there are no warning messages. This throws an
exception if either of those asserts are false.
Declaration
public fsResult AssertSuccessWithoutWarnings()
Returns
Fail(String)
Create a result that failed.
Declaration
public static fsResult Fail(string warning)
Parameters
Type |
Name |
Description |
String |
warning |
|
Returns
Merge(fsResult)
Merges the other result into this one. If the other result failed,
then this one too will have failed.
Declaration
public fsResult Merge(fsResult other)
Parameters
Returns
Warn(String)
Create a result that is successful but contains the given warning
message.
Declaration
public static fsResult Warn(string warning)
Parameters
Type |
Name |
Description |
String |
warning |
|
Returns
Operators
Addition(fsResult, fsResult)
Declaration
public static fsResult operator +(fsResult a, fsResult b)
Parameters
Returns
Extension Methods