摘要: 由public IEnumerable<Order> GetOrders(){ var orders = new List<Order>(); using (var con = new SqlConnection("some connection string")) { using (var cmd = new SqlCommand("select * from orders", con)) { using (var rs = cmd.ExecuteReader()) { w... 阅读全文
posted @ 2011-11-12 20:52 陈跳跳 阅读(575) 评论(1) 推荐(0)
摘要: String.IsNullOrEmpty()判断对象是否为Null和EmptyString.IsNullOrWhiteSpace()判断对象是否为Null和Empty和空白字符,而且性能更好,因为比较不会产生新String对象,而全用Trim().Length时全用Trim是会产生新的String对象 阅读全文
posted @ 2011-11-12 20:50 陈跳跳 阅读(5024) 评论(1) 推荐(0)
摘要: 1,过期,不用或被修改过,被重载后的方法必须加上[Obsolete("Moved to XXXX")]说明 阅读全文
posted @ 2011-11-12 20:40 陈跳跳 阅读(98) 评论(0) 推荐(0)
摘要: using System;delegate string ConvertMethod(string inString);public class Example{ public static void Demo(System.Windows.Controls.TextBlock outputBlock) { // Instantiate delegate to reference UppercaseString method ConvertMethod convertMeth = UppercaseString; string name = "Dakota... 阅读全文
posted @ 2011-11-12 20:29 陈跳跳 阅读(330) 评论(0) 推荐(0)
摘要: using System;using System.Windows.Forms;delegate void DisplayMessage(string message);public class TestCustomDelegate{ public static void Main() { DisplayMessage messageTarget; if (Environment.GetCommandLineArgs().Length > 1) messageTarget = ShowWindowsMessage; else ... 阅读全文
posted @ 2011-11-12 20:29 陈跳跳 阅读(163) 评论(0) 推荐(0)