Last active
July 30, 2016 20:28
-
-
Save isidore/f55c5455a2de28e483fef7f09b881dde to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string result = null; | |
result = result.DoIfNull(Win); | |
result = result.DoIfNull(Advantage); | |
result = result.DoIfNull(ScoreNormal); | |
result = result.DoIfNull(ScorePerson1); | |
result = result.DoIfNull(ScorePerson2); | |
result = result.DoIfNull(ScoreTie); | |
return result; | |
public static T DoIfNull<T>(this T t, Func<T> f ) | |
{ | |
if (t == null) | |
{ | |
return f(); | |
} | |
return t; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment