Skip to content

Instantly share code, notes, and snippets.

@isidore
Last active July 30, 2016 10:33
Show Gist options
  • Save isidore/78c61f790ac304b622ab55e9df84e07f to your computer and use it in GitHub Desktop.
Save isidore/78c61f790ac304b622ab55e9df84e07f to your computer and use it in GitHub Desktop.
return new Func<string>[]
{
Win,
Advantage,
ScoreNormal,
ScorePerson1,
ScorePerson2,
ScoreTie
}.FirstNonNull();
public static T FirstNonNull<T>(this IEnumerable<Func<T>> methods)
{
return methods.Select(x => x()).First(x => x != null);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment