Skip to content

Instantly share code, notes, and snippets.

@SamStephens
Created November 3, 2011 05:56
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save SamStephens/1335868 to your computer and use it in GitHub Desktop.
a-plus-abs-b C#
private int APlusAbsB(int a, int b)
{
var oper = b > 0
? (Func<int, int, int>)((x, y) => x + y)
: (x, y) => x - y;
return oper(a, b);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment