Essay classification-[c#6] new features

Source: Internet
Author: User

Summary of basic features introduced in c#6.0

[C#6] 7-index initializer summary: 0. Directory c#6 new feature directory 1. The old version of the code introduced in the early c#3 of the set initializer, but let us use the above syntax to declare a dictionary or set to initialize some of the items immediately, in fact, in c#3 this is a syntactic sugar, the result of the actual compilation is to call the dictionary or the collection of the Add method of adding these items. But a little bit is not intuitive. First look at this version of IL: Essence Read full text posted @2016-07-09 22:00 Blackheart Reading | comment (one) edit [C#6] 6-the member function in the form of an expression summary: 0. Directory c#6 new feature directory 1. The old version of the code usually, some simple read-only properties and methods only one line of code, but we also have to follow the tedious syntax to implement it. C#6 has a thin syntax that is highly consistent with the lambda syntax to help us simplify these syntaxes. First look at the old version of IL code (here I do not expand IL, look at the structure can be, are common properties and methods to read the full text posted @2016-07-08 21:49 Blackheart Reading | Comments (0) edit [C#6] 5-Automatic Attribute enhancement Summary: 0. Directory c#6 new feature directory 1. The old version of code usually, the properties of C # can help us do the work well, such as the above code. When assigning a value to a property, we can assign it anywhere. However, there is no syntax like a field declaration and an immediate initialization to simplify the setting of default values. C#6 brings us this new syntax, like assigning a value to a field as a value.read the full textPosted @2016-07-06 22:33 Blackheart reading (339) | Comments (0) edit [c#6] 4-string interpolation summary: 0. Directory c#6 new feature directory 1. The old version of the code is usually when we format the string using the static method format string concatenation, and then use {0} ... {n} to act as a placeholder. If {n} is too large, the readability of the code is drastically reduced, and C#6 introduces a new syntax to simplify this writing method. 2. $ "{xxx:}" to read the full text between us posted @2016-07-05 21:57 Blackheart reading (239) | Comments (1) edit [C#6] 3-null conditional operator Summary: 0. Directory c#6 new feature directory 1. The old version of the code when we use the properties of an object, sometimes the first thing to do is to determine whether the object itself is bull, otherwise you may get a System.NullReferenceException exception. Although sometimes we can use the ternary operator string name = Read Full text posted @2016-07-04 21:26 Blackheart reading (586) | Comments (4) edit [c#6] 2-nameof operator Summary: 0. Directory c#6 new feature directory 1. The old version of the code is no problem and works well. Over time, one day, I think that the args parameter name is not appropriate, want to change a more intuitive name filepaths, indicating that I want to accept an array of file paths. Then we reconstructed the name of the args directly, but, the throw new Argume read the full text posted @2016-07-03 00:34 Blackheart reading (587) | Comments (0) edit [c#6] 1-using static Summary: 0. Directory c#6 new feature directory 1. The old version of the code above this code is familiar to us, using static Class Console static method WriteLine output a line of string. Interstitial point about the CLR, the CLR has a namespace concept when it executes the IL, and it knows only the fully qualified name of the member (c#1 type basis). That is, in the call CO Read full posted @2016-07-02 19:34 blackheart reading (584) | Comments (0) edit [c#6] 0-Overview Summary: 1. The new features of the c#6 new feature Atlas c#6 are mainly generated by the compiler ("Roslyn") and do not rely on the CLR and. NET framework upgrades, and we can consider the main purpose of this version of the new language feature in order to simplify the way code is written, Let's program in a more intuitive and efficient way, essentially some syntactic sugar. The main features are described in detail below for each feature: 2 Read full posted @2016-07-02 17:40 Blackheart Reading (208) | Comments (0) edit

Essay classification-[c#6] new features

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.