摘要: 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Runtime.Serialization.Formatters.Binary; 6 using System.IO; 7 8 namespace _07对象序列化 9 { 10 class Program 11 { 12 static void Main(string[] args) 13 { 14 ... 阅读全文
posted @ 2013-07-24 21:13 墓地de小草 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 1 using System; 2 using System.IO; 3 4 [, using System; 5 using System.Collections.Generic; 6 using System.Linq; 7 using System.Text; 8 using System.IO; 9 10 namespace _07文件操作1_Path类11 {12 class Program13 {14 static void Main(string[] args)15 {16 //Path类中方法,基本都是... 阅读全文
posted @ 2013-07-24 21:10 墓地de小草 阅读(244) 评论(0) 推荐(0) 编辑
摘要: 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Collections; 6 7 namespace _06为什么有些类可以使用foreach循环遍历 8 { 9 class Program 10 { 11 static void Main(string[] args) 12 { 13 //ArrayList arrList1 = n... 阅读全文
posted @ 2013-07-24 17:38 墓地de小草 阅读(239) 评论(0) 推荐(0) 编辑
摘要: 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace _03泛型约束 7 { 8 9 class Student10 {11 12 }13 class Program14 {15 static void Main(string[] args)16 {17 Person p1 = new Person();18 ... 阅读全文
posted @ 2013-07-24 17:24 墓地de小草 阅读(386) 评论(0) 推荐(0) 编辑
摘要: 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace _03弱引用 7 { 8 class Program 9 {10 static void Main(string[] args)11 {12 //Person p = new Person();13 //p.Age = 100;14 //p = null;15... 阅读全文
posted @ 2013-07-24 13:09 墓地de小草 阅读(261) 评论(0) 推荐(1) 编辑
摘要: (1)string是引用类型:string是引用类型,这就是说string在堆上保存数据,而在栈中存储的是对象地址,在理解string类型特性时首先需要记住这点。只不过与其它一些引用类型相比,它又有一些比较特殊的特性,比如下面的这些:(2)string是不可变的(immutable):string的这一特性是指,对于已有的一个string对象,当你修改它时,实际是重新创建了一个符合你要求的string对象。我通过以下的例子进行演示:staticvoidMain(string[] args){stringx ="should it matter"; x = x +" 阅读全文
posted @ 2013-07-17 20:50 墓地de小草 阅读(210) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;namespace _05标志枚举{ class Program { static void Main(string[] args) { //FileInfo info = new FileInfo(@"c:\hello.txt"); //Console.WriteLine(info.Attributes); ... 阅读全文
posted @ 2013-07-17 20:28 墓地de小草 阅读(187) 评论(0) 推荐(0) 编辑
摘要: 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace _09new关键字用来隐藏父类方法 7 { 8 class Program 9 {10 static void Main(string[] args)11 {12 ////Person p = new Chinese();13 ////p.SayHi();14 ... 阅读全文
posted @ 2013-07-17 20:14 墓地de小草 阅读(336) 评论(0) 推荐(0) 编辑
摘要: 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace _16静态成员静态类 7 { 8 class Program 9 {10 static void Main(string[] args)11 {12 13 14 //MyClass mc = new MyClass();15 //mc.... 阅读全文
posted @ 2013-07-17 19:51 墓地de小草 阅读(250) 评论(0) 推荐(0) 编辑
摘要: 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace _14用虚方法实现多态 7 { 8 public class Person 9 {10 public Person(string name)11 {12 this.Name = name;13 }14 public string Name15 {16 ... 阅读全文
posted @ 2013-07-17 19:46 墓地de小草 阅读(175) 评论(0) 推荐(0) 编辑