Effective C # notes

The first chapter C # language elements

Item 1: always have attributes, do not use the data member can be accessed
item 2: make use of a constant term readonly, instead const
Item 3: When installed for the type, do not use a cast, or is used as operator
Item 4: Use Conditional marker instead of conditional compilation #if
item 5: for each class you create a write ToString () function
item 6: clear value and reference type distinction
item 7: to select the base type immutable
item 8: for value type 0 guarantee value represents a valid status
item 9: understanding ReferenceEquals (), static Equals (), example Equals () and operator == distinction between
item 10: understanding GetHashCode () defect
entries 11: foreach loop to make use of

Chapter .NET Resource Management

Item 12: The variable initialization statement instead of an assignment statement
item 13: use a static constructor to initialize static class members
Item 14: Use the constructor chain
item 15: the use of using statements and try / finally to release resources
Item 16: Reduce memory garbage
items 17: reduce the boxing and unboxing
item 18: Dispose implement standard mode

The third chapter with C # express your design ideas

Item 19: define and implement interfaces, rather than inheriting
Item 20: implement the interface and override clear distinction virtual function
Item 21: The expression of a callback claim Delegate
Item 22: Event is defined by an outer outgoing interface
Item 23: Returns the class avoid internal referenced object
entries 24: to make use of declarative programming, not imperative programming
key 25: to make use of type Serializable
item 26: use IComparable and IComparer interface sortable relationship
entry 27: avoid implementing ICloneable
item 28: avoid implementing type conversion operation Fu
item 29: Do not use the new modifier, unless you change the base class requires you to use it

Chapter IV Creating binary components

Item 30: CLS possible to create an assembly line with specifications
of 31: small and simple as possible to create a function
Item 32: small as possible and to create a cohesive assembly
Item 33: Create your limit the visibility of the type
of 34: Create Large- Grain (one transfer multiple data) Web call Interface

Chapter 5 Using the .NET Framework

Item 35: inheritable possible to realize a function rather than an event handler
entries 36: effective use of the .NET runtime diagnostic function
key 37: Standard configuration mechanism
Item 38: Use and support data binding
item 39: authentication using .NET mechanism
item 40: use according to your needs of different classes Collection
item 41: make use DataSet, instead of the custom configuration
of 42: use properties to simplify reflection
item 43: Do not over-use reflection
and 44: create complete applications special exception classes

Chapter 6 Other

Item 45: to make use of strong exception guarantee
item 46: using as little as possible Interoperability (the Interop)
Item 47: to make use of the security code
entry 48: focused on developing tools and resources
item 49: C # 2.0 to prepare
item 50: Follow ECMA standard

                                           December 15, 2008

Reproduced in: https: //www.cnblogs.com/MichaelGuan/archive/2008/12/15/1355489.html

Guess you like

Origin blog.csdn.net/weixin_34161064/article/details/94290087