C# 常量分类与测试
关注我,带你了解C#的魅力
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace 常量分类与测试
{
internal class Program
{
readonly int it; //动态常量 在构造函数内 后侧讲到,此处了解下
Program()
{ int it = 21332;
Program he = new Program();
}
static void Main(string[] args)
{
const double PI = 3.1415926; //常量分为 const 静态 readonly 动态
const double PI2 = 234;
Console.WriteLine("PI的值为:"+PI);
Console.WriteLine("PI2的值为:"+PI2);
Console.ReadLine();
}
}
}