5

thank you for looking at my question, to verify what i mean

Console.WriteLine($"Hello {variable}");

I am curious to the effect that the $ has on the output from Console.WriteLine

Rahul
  • 73,987
  • 13
  • 62
  • 116
TJ Corey
  • 51
  • 1
  • 1
  • 2

2 Answers2

12
Console.WriteLine($"Hello {variable}");

Is I think equal to:

Console.WriteLine(string.Format("Hello {0}", variable));

It just moves the parameter into the index position as if you were formatting it.

topdog
  • 357
  • 1
  • 7
5

It is a new feature to use in addition to string.Format

It's called Interpolated Strings

Thaina Yu
  • 1,228
  • 2
  • 14
  • 24