C#学习
Random r = new Random(); Console.WriteLine(r.Next() % 10);//产生0-9之间的随机数
int[] pins = new int[10]{1,2,3,4,5,6,7,8,9,0};//定义数组并初始化
foreach (int pin in pins)//使用foreach遍历数组中的元素 { Console.WriteLine(pin); }
class Child { public string name; public int age; /// <summary> /// 重写构造方法 /// </summary> /// <param name="name"></param> /// <param name="age"></param> public Child(string name,int age)//前面不写返回值类型,如果写了就会出错 { this.name = name; this.age = age; } }