摘要: //获得指定文件夹所有文件的路径 string[]path=Directory.GetFiles(@"C:\Users\Administrator\Desktop\新建文件夹"); 阅读全文
posted @ 2016-04-19 20:17 思维乐趣 阅读(322) 评论(0) 推荐(0) 编辑
摘要: Dictionary<int, string> dic = new Dictionary<int, string>(); dic.Add(1, "睛睛青"); dic[2] = "sb"; foreach (KeyValuePair<int, string> kup in dic) { Consol 阅读全文
posted @ 2016-04-16 13:36 思维乐趣 阅读(367) 评论(0) 推荐(0) 编辑
摘要: //使用多态求矩形的面积和周长以及圆形的面积我周长 Shape shape = new Circle(5); //new Square(5,6); double area = shape.GetArea(); double perimeter = shape.GetPerimeter(); Cons 阅读全文
posted @ 2016-04-16 01:32 思维乐趣 阅读(1197) 评论(0) 推荐(0) 编辑
摘要: 更改前超复杂: static void Main(string[] args) { //真的鸭子嘎嘎叫 木头鸭子吱吱叫 橡皮鸭子唧唧叫 RealDuck rd = new RealDuck(); rd.Bark(); MuDuck md = new MuDuck(); md.Bark(); XpDu 阅读全文
posted @ 2016-04-15 22:43 思维乐趣 阅读(349) 评论(0) 推荐(0) 编辑
摘要: ////使用StreamReader来读取一个文本文件 //using (StreamReader sr = new StreamReader(@"C:\Users\Administrator\Desktop\sb.txt",Encoding.Default)) //{ // while(!sr.E 阅读全文
posted @ 2016-04-15 19:26 思维乐趣 阅读(275) 评论(0) 推荐(0) 编辑
摘要: //思路:就是先将要复制的多媒体文件读取出来,然后再写入到你指定的位置 //C:\Users\Administrator\Desktop\01类.avi string source = @"C:\Users\Administrator\Desktop\01类.avi"; string target 阅读全文
posted @ 2016-04-15 19:02 思维乐趣 阅读(192) 评论(0) 推荐(0) 编辑
摘要: //指定位置写入文件 //没有这个文件的话 会给你创建一个 有的话会覆盖 string str = "今天下雨"; byte[] buffer = Encoding.Default.GetBytes(str); File.WriteAllBytes(@"C:\Users\Administrator\ 阅读全文
posted @ 2016-04-15 10:39 思维乐趣 阅读(201) 评论(0) 推荐(0) 编辑
摘要: Hashtable ht = new Hashtable(); ht.Add(1,"张三"); ht.Add(2, 2); ht.Add(3.14,500m); //在键值对集合中键必须是唯一的 //ht.Add(1, 5);//这样会抛异常 ht[1] = "李四";//表示将键1值替换掉 //如 阅读全文
posted @ 2016-04-15 10:08 思维乐趣 阅读(172) 评论(0) 推荐(0) 编辑
摘要: private const string Jian = "阿"; private const string Fan = "阿"; static void Main(string[] args) { //将用户输入的简体字转换成繁体字 Hashtable ht = new Hashtable(); f 阅读全文
posted @ 2016-04-14 22:44 思维乐趣 阅读(201) 评论(0) 推荐(0) 编辑
摘要: Stopwatch sw = new Stopwatch(); int[] nums = new int[10000]; sw.Start(); for (int i = 0; i < nums.Length; i++) { Console.WriteLine(nums[i]); } sw.Stop 阅读全文
posted @ 2016-04-14 21:52 思维乐趣 阅读(182) 评论(0) 推荐(0) 编辑