Skip to content

Instantly share code, notes, and snippets.

@TheDarkTrumpet
Created September 7, 2016 18:54
Show Gist options
  • Select an option

  • Save TheDarkTrumpet/89317489bdc8a917b06804a2e61cbbd4 to your computer and use it in GitHub Desktop.

Select an option

Save TheDarkTrumpet/89317489bdc8a917b06804a2e61cbbd4 to your computer and use it in GitHub Desktop.
string contatenation
StringBuilder foo = new StringBuilder();
foo.Append("Bar");
foo.Append(null); // <-- Doesn't work, object and string ambiguous
foo.Append(" car");
foo.Dump();
string foo2 = "bar";
foo2 += null;
foo2 += " car";
foo2.Dump();
// "bar car"
string foo3 = String.Join(" ", new List<Object>() { "bar", null, "car" });
foo3.Dump();
// "bar car"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment