Skip to content

Instantly share code, notes, and snippets.

View SamStephens's full-sized avatar

Sam Stephens SamStephens

  • New Zealand
View GitHub Profile
@SamStephens
SamStephens / gist:1335868
Created November 3, 2011 05:56
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);
}