摘要:
Static field initializers run just beforethe static constructor is called. If a type has nostatic constructor, field initializers will execute just prior to the type being used—or anytime earlierat the whim of the runtime. (This means that the presence of astatic constructor may cause field initial. 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
Resharp很好用的的开发工具。输入很快。大家可以百度“Resharp”现在我来展示一下 其职能提示:可以自动生成一下代码 ,可以分析代码的友好度。 private readonly IRepositoryService<Enrollment> _enrollmentService;或者直接进入官网看看。http://www.jetbrains.com/resharper/features/code_generation.html#Generate_Type_Constructor 阅读全文