Is it possible to include a C# variable in a string variable without using a concatenator?

前端 未结 14 1761
遥遥无期
遥遥无期 2021-02-14 07:02

Does .NET 3.5 C# allow us to include a variable within a string variable without having to use the + concatenator (or string.Format(), for that matter).

For example (In

14条回答
  •  我在风中等你
    2021-02-14 07:40

    No, it doesn't. There are ways around this, but they defeat the purpose. Easiest thing for your example is

    Console.WriteLine("The date is {0}", DateTime.Now);
    

提交回复
热议问题