Last active
August 29, 2015 14:25
-
-
Save caglartoklu/33d6d698455a2e02aa8b to your computer and use it in GitHub Desktop.
C# String Interpolation #cs #string
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
using System; | |
public class Program | |
{ | |
public static void Main() | |
{ | |
// simple string interpolation | |
string someString = @" | |
Do you have a {0} {1} ? | |
"; | |
Console.WriteLine(string.Format(someString, "red", "car")); | |
// some more: | |
// http://haacked.com/archive/2009/01/04/fun-with-named-formats-string-parsing-and-edge-cases.aspx/ | |
// C# 6.0 implementation: | |
// https://stackoverflow.com/a/26977877 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment