public
Created

String interpolations in C#

  • Download Gist
example.cs
C#
1 2 3 4 5 6
var userName = "ChrisMissal";
var someString = "Hello, my name is $(userName), nice to meet you!";
 
var a = "Now is $(DateTime.Now).";
var b = "Tomorrow will be $(DateTime.Now.AddDays(1))";
var c = "This list has $(list.Count()) items.";

They should use the Razor syntax for this...

var a = "Now is @{DateTime.Now}.";

Yeah, I can get on board with that. I'm fine with whatever syntax, I just feel that something needs to be implemented. I believe the syntax I posted is how Boo does it.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.