摘要: Instead of using object initializers, we could make Bunny’s constructor accept optional parameters:1 public Bunny (string name,2 bool likesCarrots = false,3 bool likesHumans = false)4 {5 Name = name;6 LikesCarrots = likesCarrots;7 LikesHumans = likesHumans;8 }This would allow us to construct a Bunny 阅读全文
posted @ 2013-06-05 20:29 futan57 阅读(157) 评论(0) 推荐(0) 编辑
摘要: Lambda expressions and captured variables As we saw, a lambda expression is the most powerfulway to pass data to a thread. However, you must becareful about accidentally modifying captured variablesafter starting the thread, because these variablesare shared. For instance, consider the following: 1 阅读全文
posted @ 2013-06-05 15:57 futan57 阅读(99) 评论(0) 推荐(0) 编辑