Valid C #: 50 specific ways to improve your C # Reading Notes

Source: Internet
Author: User

Reading and learning are very rewarding. Write down the translation and your own experience. You are welcome to make a brick

Chapter 1 C # Language Element
Item 1: Always use properties instead of accessible data members
Item 2: prefer readonly to const
Item 3: prefer the is or as operators to casts
Item 4: Use conditional attributes instead of # If
Item 5: always provide tostring ()
Item 6: distinguish between value types and reference types
Item 7: prefer immutable atomic value types
Item 8: ensure that 0 is a valid state for value types
Item 9: understand the relationships among equals
Item 10: Understand the pitfalls of gethashcode ()
Item 11: prefer foreach Loops
Chapter 1
Chapter 2. NET Resource Management
Item 12: prefer variable initializers to assignment statements
Item 13: Initialize static class members with static constructiors
Item 14: Utilize constructor chaining
Item 15: Utilize using and try/finally for resource cleanup
Item 16: Minimize garbage
Item 17: Minimize boxing and unboxing
Item 18: implement the standard dispose Pattern
Chapter 3 expressing designs with C #
Item 19: prefer defining and implementing interfaces to inheritance
Item 20: distinguish between implementing interfaces and overriding virtual functions
Item 21: Express callbacks with delegates
Item 22: Define outgoing interface with events
Item 23: avoid returning references to internal class objects
Item 24: prefer declarative to imperative Programming
Item 25: prefer serializable type
Item 26: Implement ordering relations with icomparable and icomparer
Item 27: Avoid icloneable
Item 28: avoid conversion Operators
Item 29: use the new modifier only when base class updates mandate it
Chapter 4 Create binary components
Item 30: prefer CLS-compliant assemblies
Item 31: prefer small, simple functions

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.