VS2015 c#6.0

Source: Internet
Author: User
Tags microsoft video

The new features in VS2015 c#6.0

VS2015 on their own machine is really installed, (all installed, in the Java SE Development Kit will lag for a long time, I directly shut down, and then restart the computer, repair the installation done),

Want to experience the pleasure of cross-platform, the result was Microsoft mercilessly came a stick, installed or not use, should also be installed Xarmain plug-ins, configuration some parameters it,

Since this piece has never been touched before, think about it or not to continue to waste time here, so to experience the new features.

Resources:

1:chs-whatsnewinc# 6.0 (Microsoft Video) Link: http://pan.baidu.com/s/1kTjLyjt Password: V6MR

2:vs2015csharp6.0 (English document) Link: Http://pan.baidu.com/s/1eQsddtC Password: kvg1

1. Automatic attribute Enhancement

1.1. Automatic attribute initialization (initializers for auto-properties)

c#5.0 under the resolute realization cannot.

How automatic attributes are initialized in c#6.0

1.2. Read-only property initialization getter-only Auto-properties

Let's take a look at the way we used to do it.

And look at the c#6.0.

And the first automatic property initialization is used in the same way.

2. Reference static class using static

You can specify a static class in the using, and then you can use the static member directly in the subsequent code

3. String embedding value

Embed a value in a string that has been used all the way before

Now we can simply stitch in the following way

4. Expression bodied function members

4.1 Using lambda as function body expression bodies on Method-like members

4.2 Using a lambda expression as an attribute expression bodies on Property-like function members

5. Indexed Object initializer index initializers

6, empty value judgment null-conditional operators

7. nameof Expression nameof expressions

In the method parameter check, you may often see this kind of code (used less, this time also learned)

There's that point inside of our handwritten string, it's easy to forget the following string when we rename it, c#6.0 nameof helps us solve the problem and see how it's written.

8. Abnormal filter (Exception filters)

Let's take a look at a transplant method.

the transplant method .

Another usage is given in Microsoft's documentation, which is thrown to the previous caller when the log record fails

Microsoft's document handling exceptions

9, catch and finally await--await in catch and finally blocks

In c#5.0, the await keyword cannot appear in catch and finnaly blocks. And in 6.0,

C # 6.0 await

VS2015 c#6.0

Related Article

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.