Closed danielepo closed 7 years ago
Currently Scientist only has support for inspecting a return value. I came up with a way that could be used to inspect out parameters. Basically it wraps up all outputs (returns, outs, refs) into one return result, however this may be more cumbersome to use.
IntTryParseResult ParseInt(string s) {
return Scientist.Science<IntTryParseResult>(nameof(ParseInt), experiment => {
experiment.Use(() => {
int value;
bool success = int.TryParse(s, out value);
return new IntTryParseResult(value, success);
});
});
}
class IntTryParseResult {
public IntTryParseResult(int value, bool success);
public bool Success { get; }
public int Value { get; }
}
Is there an advised way to verify the status of out parameters?