Reading Notes: positive C # Chinese version: 50 ways to improve C # Program (translated by Li Jianzhong)
Source: Internet
Author: User
Chapter 2 C # Language element 1
Clause 1: Use properties to replace accessible data member 1
Clause 2: readonly is better than Const. 12
Clause 3: operator is or as is better than forced transformation 17
Clause 4: Use the conditional feature instead # If condition compilation 25
Clause 5: The tostring () method 31 is always provided.
Clause 6: Use Cases for distinguishing value types and reference types 38
Clause 7: Implement value type as constant and atomic type as much as possible 44
Clause 8: ensure that 0 is a valid status of the value type 51
Clause 9: understand the relationship between several equal judgments 56
Clause 10: Understanding the defects of the gethashcode () method 63
Clause 11: preference for foreach loop statement 70
Chapter 2. NET Resource Management 77
Clause 12: The variable initiator is superior to the value assignment statement 82.
Clause 13: Use a static constructor to initialize a static class member 84
Clause 14: using the constructor chain 87
Clause 15: Use Using and try/finally statements to clear resources 93
Clause 16: Minimize memory spam by 100
Article 17: Try to reduce packing and unpacking by 103
Article 18: Standard dispose mode 109
Chapter 2 use C # expression design 3rd
Clause 19: define and implement interfaces better than inheritance types 118
Article 20: explicit interface implementation and virtual method rewriting 125
Article 21: Delegate expression callback 129
Clause 22: Use the event definition outbound interface 131
Clause 23: avoid returning references to internal class objects 137
Clause 24: Declarative Programming is 142 better than imperative Programming
Clause 25: Implement type as serializable type 148 as much as possible.
Clause 26: Use the icomparable and icomparer interfaces for sorting 156
Article 27: icloneable interface avoidance 163
Clause 28: avoid forced conversion operator 167
Clause 29: The new modifier 172 is considered only when the new version of the base class causes problems.
Chapter 4 Create a binary component 4th
Clause 30: Implement CLS compatible Assembly 181 as much as possible
Clause 31: implement a short and concise function 186 as much as possible
Cla32: Try to implement small-size, high-cohesion Assembly 190
Cla33: restriction type visibility 194
Clause 34: create a large-granularity web API 198
Chapter 4 usage framework 5th
Article 35: rewrite over event processor 205
Clause 36: diagnose the rational use of. Net runtime 208
Article 37: standard configuration mechanism 213
Article 38: Custom and support data binding 217
Clause 39: use. Net for verification 224
Clause 40: select an appropriate set as needed 229
Cla41: DataSet is superior to custom structure 237
Article 42: Simplified reflection by features 246
Cla43: avoid excessive use of reflection 253
Cla44: create a specific exception category for the Application 258
Chapter 2 miscellaneous discussion 6th
Clause 45: preferentially Choose strong exception security assurance 265
Cla46: Minimum interoperability 270
Article 47: Security Code 277 is preferred
Clause 48: Master related tools and resources 281
Clause 49: Prepare for C #2.0 284
Clause 50: Understand ECMA standard 293
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service