Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Response/Option
public class Response<T>
{
public static implicit operator bool(Response<T> response)
{
return response.Success;
}
public bool Success { get; private set; }
public T Value { get; private set; }
public Response(bool success, T value)
{
Success = success;
Value = value;
}
public void If(Action<T> success, Action notSuccess)
{
if (Success)
success(Value);
else
notSuccess();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.