C #2.0 New Features

Source: Internet
Author: User

1,Generics: in my opinion, generics are achieved by parameterization of Data TypesCodeMore flexible reuse, the emergence of generic makesC #You can use the same piece of code to operate on multiple data types. Generic is undoubtedlyC #2.0The emergence of the most significant improvement givesC #Stronger type security, better reuse, higher efficiency and clearer constraints of code.

 

2,Anonymous method: the anonymous method allows us to directly associate code with the delegated instance, making the delegated instantiation more intuitive and convenient. In my opinion, this is justC #There is another syntax format. Instead of passing the method name to the delegated instance, there is another option.

 

3,Iterator: iterator allows us to write more convenientlyForeachStatement type. In my opinion, the appearance of the iterator is only an improvement.1.0InaccessibilityForeachRestrictions on the writing of statement types simplify some interfaces.

 

4,Local type: the local type allows us to write the code of a class in differentCSFile. The most typical application is to useVs2005CreateFormFile,VSThe generated code is automatically separated from the user code. The local type is passedPartialKeyword.

 

5,Null type: the null type is an image.Int? Can be empty. Essentially a generic applicationSystem. nullable <>.

 

6,Static class: a static class is only used to contain static members. It cannot be instantiated or inherited.

 

conclusion: these are some new features that I understand C #2.0 . Some features may be inaccurate. Of course, C #2.0 some other new features are not mentioned here, for example, different access restrictions for the Get and set accessors of the attribute and so on. C #3.0 is under development, C #3.0 introduces XML and / span> SQL two data processing technologies, let's look forward to it together.

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.