code_junkie

Coalesce vs empty string concatenation

Nov 13th, 2011
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.17 KB | None | 0 0
  1. string foo = "" + str;
  2.  
  3. string foo = str ?? "";
  4.  
  5. string foo = str ?? "";
  6.  
  7. string foo = str == null ? "" : str;
  8.  
  9. string foo = "";
  10. if (str != null) foo = str;
Add Comment
Please, Sign In to add comment