我通過微軟的C# tutorial來學習.net,我已經把這段代碼放到我的VS 2013中,出於某種原因,輸出顯示「$」是一個意想不到的字符。在本教程中也沒有提及從系統using
東西側,MS C#教程代碼在VS2013中不起作用?
從MS
using System;
class Program
{
static void Main()
{
var name = "Steve"; // use your name here
Console.WriteLine($"Hello {name}!");
}
}
我有什麼
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main()
{
var name = "John";
Console.WriteLine($"Hello {name}!");
}
}
}
VS2013說,它期待一個「)」中的一部分其寫入的行($"Hello {name}!");
如果我刪除了$,它會輸出句子,因爲它的寫法爲您好{name}!
還有什麼問題呢?
哦,我只需要更新好,真棒謝謝奧利維爾! – Umeed