Skip to content

Instantly share code, notes, and snippets.

@reidev275
Created December 19, 2014 14:27
Show Gist options
  • Save reidev275/03172e646b0771177d98 to your computer and use it in GitHub Desktop.
Save reidev275/03172e646b0771177d98 to your computer and use it in GitHub Desktop.
Descriptive responses from methods. Rather than returning null return an Atom or a Result<T>
public enum Atom
{
OK, Unauthorized, NotFound, Forbidden
}
public class Result<T>
{
readonly Atom _atom;
readonly T _obj;
public Result(Atom atom, T obj)
{
_atom = atom;
_obj = obj;
}
public Atom Atom { get { return _atom; } }
public T Data { get { return _obj; } }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment