提到类首先会想到面向过程与面向对象这两种编程方式,很多初学者习惯面向过程的编程方式,当提到面向对象的时候会茫然,其实只是把面向过程的稍加改动放在类的方法中,就OK了
匿名类的写法: var anyName =new { Name=" " } ,匿名类就是省略了定义类的名字.如果两个匿名类的字段的个数相等且相同,那么这两个匿名类可以直接进赋值.
下面简单提一下静态static,在定义变量前加上关键字static就是静态变量了,程序默认静态变量的初始值为0,值会随着程序的调用而改变,在程序中只能调用静态字段或静态方法(它没构造函数),当你想输出的时候,类名.静态字段名或是类名.静态方法!!!