Skip to content

Instantly share code, notes, and snippets.

@caglartoklu
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caglartoklu/33d6d698455a2e02aa8b to your computer and use it in GitHub Desktop.
Save caglartoklu/33d6d698455a2e02aa8b to your computer and use it in GitHub Desktop.
C# String Interpolation #cs #string
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