$是对string.Format的简化
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace test4 { class Program { static void Main(string[] args) { //$是对string.Format的简化。 //变化点:string.Format() {0} string a1 = string.Format("Time :{0}", DateTime.Now); Console.WriteLine(a1); string a2 = $"Time :{DateTime.Now}"; Console.WriteLine(a2); Console.ReadKey(); } } }
树立目标,保持活力,gogogo!