语言是用来表达思想的,语言虽然千差万别,但也大同小异,下面以两个非常简单的控制台应用程序来入门C#
程序1:
using System;
class Example
{
static void Main()
{
int[] a = new int[10]; //注意和C/C++相区别
int i;
for (i = 0; i < 10; i++)
a[i] = i;
for (i = 0; i < 10; i++)
Console.WriteLine(a[i]);
}
}
程序2:
using System;
class Vehicle
{
public int passenger;
}
class Example
{
static void Main()
{
Vehicle v = new Vehicle(); //注意和C++相区别
v.passenger = 100;
Console.WriteLine("passenger is " + v.passenger);
}
}