C#变量定义和赋值简单实用范例
C# (Csharp)是类型安全的语言。 变量定义类似于C,下面是代码演示。
using System; class MainClass { public static void Main() { int var1; // declares a variable int var2; // declares another variable var1 = 1300; // this assigns 100 to var1 Console.WriteLine("var1 value is " + var1); var2 = var1 / 2; Console.Write("var2 contains var1 / 2: "); Console.WriteLine(var2); } }
附件:源代码下载