找到一个路径,"C:\Windows\Microsoft.NET\Framework64\v4.0.30319",将此路径添加到环境变量。
在Windows 11里,Setting--About--Advanced System Settings--Environment Variables,双击Path。
PS C:\Users\a-xiaobodou\> csc
Microsoft (R) Visual C# Compiler version 4.8.9032.0
for C# 5
Copyright (C) Microsoft Corporation. All rights reserved.This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to C# 5, which is no longer the latest version. For compilers that support newer versions of the C# programming language, see http://go.microsoft.com/fwlink/?LinkID=533240warning CS2008: No source files specified
error CS1562: Outputs without source must have the /out option specified
PS C:\Users\a-xiaobodou\OneDrive - Microsoft\Projects\C#\csharpmagic\第2章> csc StringFormatDemo.cs
Microsoft (R) Visual C# Compiler version 4.8.9032.0
for C# 5
Copyright (C) Microsoft Corporation. All rights reserved.This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to C# 5, which is no longer the latest version. For compilers that support newer versions of the C# programming language, see http://go.microsoft.com/fwlink/?LinkID=533240PS C:\Users\a-xiaobodou\OneDrive - Microsoft\Projects\C#\csharpmagic\第2章> ./StringFormatDemo.exe
当前时间:1/23/2024 2:57:52 PM, 温度是:24.5°C。
当前日期:1/23/2024,时间:2:57 PMYear Population2013 1,025,6322014 1,105,9672015 1,148,203BeiJing 2024 123,456.00 32.0%
123.46
00123.400
打印大括号用法相同:{ 和 }{ 和 }
两个路径是相同的:
c:\china-pub\C#\sample-code
c:\china-pub\C#\sample-code