Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jonfuller
Created May 27, 2010 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonfuller/415778 to your computer and use it in GitHub Desktop.
Save jonfuller/415778 to your computer and use it in GitHub Desktop.
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