Tive C # Summary (all)

Source: Internet
Author: User

Valid C #

Chapter 1 C # Language Elements

Item 1: Always use proPerties. Do not use accessible data members.
Item 2: Always use readonly instead of Const.
Item 3: Do not use forced conversion when type is changed. Use the is or as operator.
Item 4: Use the conditional mark instead # If condition Compilation
Item 5: Write A tostring () function for each class you have created
Item 6: Identify the differences between the value type and the reference type
Item 7: select an unchangeable basic type
Item 8: ensure that 0 represents a valid state for the value type.
Item 9: understand the differences between referenceequals (), static equals (), instance equals (), and =
Item 10: Understand the defects of gethashcode ()
Item 11: Use a foreach loop whenever possible

Chapter II. NET Resource Management

Item 12: Use a variable initialization statement instead of a value assignment statement.
Item 13: Use a static constructor to initialize a static class member
Item 14: Construct a function chain
Item 15: Use the using statement and try/finally to release resources
Item 16: reduce memory Spam
Item 17: reduce packing and unboxing
Item 18: implement the standard dispose Mode

Chapter 3 use C # to express your design ideas

Item 19: define and implement interfaces instead of Inheritance
Item 20: identify the differences between implementing interfaces and rewriting virtual functions
Item 21: Use delegate to express callback requirements
Item 22: Use event to define the outbound sending Interface
Item 23: avoid returning reference to internal objects of the class
Item 24: Declarative Programming instead of imperative Programming
Item 25: Use the serializable type whenever possible
Item 26: Use the icomparable and icomparer interfaces for sorting
Item 27: avoid implementing icloneable
Item 28: avoid implementing type conversion Operators
Item 29: Do not use the new modifier, unless the base class changes require you to use it

Chapter 4 Create a binary component

Item 30: try to create an assembly that meets the CLS specifications
Item 31: create small and simple functions as much as possible
Item 32: try to create a small and cohesive assembly
Item 33: restrict the visibility of the type you created
Item 34: create a large-grain (multiple data are transferred at a time) web call interface

Chapter 4 Use the. NET Framework

Item 35: Implement inherited functions as much as possible, rather than event handlers
Item 36: Use the. NET runtime diagnostic function effectively
Item 37: use the standard configuration Mechanism
Item 38: use and support data binding
Item 39: Use the. NET authentication mechanism
Item 40: use different collection classes as needed
Item 41: Try to use dataset instead of custom Structure
Item 42: use attributes to simplify the reflection mechanism
Item 43: Do not excessively use the reflection mechanism
Item 44: create a complete application-specific exception class

Chapter 2 Miscellaneous

Item 45: use exception assurance whenever possible
Item 46: Use InterOP as little as possible)
Item 47: use security code whenever possible
Item 48: focus on development tools and resources
Item 49: Prepare for C #2.0
Item 50: Focus on ECMA standards

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.