Created
September 7, 2016 18:54
-
-
Save TheDarkTrumpet/89317489bdc8a917b06804a2e61cbbd4 to your computer and use it in GitHub Desktop.
string contatenation
This file contains hidden or 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
| 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