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)

导航