上一页 1 2 3 4 5 6 ··· 20 下一页

2013年12月6日

有序字典

摘要: /*有序字典SortedDictionary类的使用,它是一个二叉搜索树它比SortedList的元素插入和删除速度比较快。SortedList的内存比它占用的要少,在已排序的数据填充集合时SortedList要快。*/using System.Collections.Generic;namespace Frank{ public class Test { //程序入口 public static void Main(string[] args) { SortedDictionary sd = new SortedDictionary(); sd.A... 阅读全文

posted @ 2013-12-06 15:21 wp456 阅读(169) 评论(0) 推荐(0)

Lookup类的使用

摘要: /*Lookup类的使用 一键多值*/using System.Linq;using System.Collections.Generic;namespace Frank{ public class Test { //程序入口 public static void Main(string[] args) { List list = new List(); list.Add(new Racer("jack","wuhan")); list.Add(new Racer("tom","wuhan")); list.Add 阅读全文

posted @ 2013-12-06 14:43 wp456 阅读(259) 评论(0) 推荐(0)

2013年12月5日

字典Dictionary

摘要: /*字典Dictionary (映射或者散列表)键值对的,如果把一个自定义类型作为字典的键,那么必须重写GetHashCode和Equals方法string类就实现了,一般用string类型的最为键*/using System.Collections.Generic;namespace Frank{ public class Test { //程序入口 public static void Main(string[] args) { Dictionary d = new Dictionary(); d.Add("1","a"); d.Add(" 阅读全文

posted @ 2013-12-05 14:58 wp456 阅读(129) 评论(0) 推荐(0)

有序列表

摘要: /*有序列表键值对的表示一个键只能有一个值,如果需要多个值,使用Lookup类*/using System.Collections.Generic;namespace Frank{ public class Test { //程序入口 public static void Main(string[] args) { SortedList books = new SortedList(); books.Add("1","2sad"); books.Add("2","sadsad"); books["3&qu 阅读全文

posted @ 2013-12-05 11:49 wp456 阅读(144) 评论(0) 推荐(0)

双向链表

摘要: /*双向链表放入元素速度十分的快。*/using System.Collections.Generic;namespace Frank{ public class Test { //程序入口 public static void Main(string[] args) { LinkedListNode ln = new LinkedListNode("c"); LinkedList ll = new LinkedList(); ll.AddLast("a"); ll.AddLast("b"); ll.AddLast(ln); for. 阅读全文

posted @ 2013-12-05 11:38 wp456 阅读(101) 评论(0) 推荐(0)

栈,后进先出

摘要: /*栈,后进先出*/using System.Collections.Generic;namespace Frank{ public class Test { //程序入口 public static void Main(string[] args) { Stack stack = new Stack(); stack.Push(1); stack.Push(5); stack.Push(6); stack.Push(7); foreach (int item in stack) { System.Console.Write... 阅读全文

posted @ 2013-12-05 10:42 wp456 阅读(320) 评论(0) 推荐(0)

队列的使用 先进先出的原则

摘要: /*队列的使用 先进先出的原则*/using System.Threading;using System.Collections.Generic;namespace Frank{ public class Test { //程序入口 public static void Main(string[] args) { DocumentManager dm = new DocumentManager(); ProcessDocuments.Start(dm); for(int i = 0;i documentQueue = new Queue(); ... 阅读全文

posted @ 2013-12-05 10:30 wp456 阅读(541) 评论(0) 推荐(0)

2013年11月30日

正则表达式的使用

摘要: /*正则表达式的使用*/using System.Text.RegularExpressions;namespace Frank{ public class Test { //程序入口 public static void Main(string[] args) { const string myText = "abcdeafsgabcadefgaaabcdefagaabcdefgaa"; string pattern = "a"; MatchCollection myMatches = Regex.Matches(myText,pattern... 阅读全文

posted @ 2013-11-30 16:20 wp456 阅读(177) 评论(0) 推荐(0)

string类和StringBuilder格式化的使用

摘要: /*string类和StringBuilder格式化的使用*/using System;using System.Text;namespace Frank{ public class Test { //程序入口 public static void Main(string[] args) { //string类是一个不可变的类,如果对一个string类型的变量进行多少的修改应该使用StringBuilder类,因为后者比前者速度更快,更节省空间 string str = "1"; str += "2"; StringBuilder SB = ... 阅读全文

posted @ 2013-11-30 15:02 wp456 阅读(793) 评论(0) 推荐(0)

弱事件模式(WPF里面就使用了弱事件模式)

摘要: /*弱事件直接连接发布程序和侦听器如果发布器不在连接侦听器的话垃圾回收不能清空侦听器。这种强连接可以通过弱事件模式来解决。*/using System;using System.Windows;namespace Frank{ public class WeakCarInfoEventManager : WeakEventManager { /// ///添加监听 /// public static void AddListener(object source,IWeakEventListener listener) { CurrentMangeager.ProtectedAdd... 阅读全文

posted @ 2013-11-30 13:37 wp456 阅读(306) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 ··· 20 下一页

导航