Last active
October 10, 2019 16:11
-
-
Save idusortus/e09d4dec1bf9f5ea5e83a1b2ab4382fa 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
// ternary operator | |
public static string Speak(string name="") => $"One for {(name=="" ? "you" : name)}, one for me.";} | |
// default value for optional argument | |
public static string Speak(string name="you") => string.Format("One for {0}, one for me.", name); | |
// null-coalescing assignment operator | |
public static string Speak(string name = null) => $"One for { name ?? "you"}, one for me."; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment