0

This question doesn't explain exactly what the differences between theses two are, can somebody explain that more?

I've always known of using a @ sign before a string when using slashes in the string to avoid interruption like:

Console.WritLine(@"string /");

Lately I've seen some people writing with $ like:

Console.WritLine($"string /");

I've tried to see if that works, but it doesn't even work for me it gives me a runtime error.

Does anybody know if that is even a syntax in C#?

Community
  • 1
  • 1
believe me
  • 910
  • 1
  • 5
  • 24
  • New C#6 feature called string interpolation https://msdn.microsoft.com/en-CA/library/dn961160.aspx – Pierre-Alain Vigeant Mar 11 '16 at 15:52
  • 1
    They serve completely different purposes. `$` is a compiler feature to shorten `ToString(pattern, values[])` calls. It's not a replacement or alternative for `@`. Look at the questions marked as duplicates in your two identical questions to understand the difference. – D Stanley Mar 11 '16 at 16:33
  • @DStanley thanks, my bad I didn't hear of it until now. – believe me Mar 11 '16 at 16:34

0 Answers0