C #5.0 what are new things with VB. NET?

Source: Internet
Author: User

1. asynchronous programmingBecause on mobile devices, the response speed of a program is too important, so the response to the application after being touched is equally important. In Windows Runtime, designers always need to consider that if an interactive operation takes more than 50 milliseconds, asynchronous programming should be used to solve slow responses. Although Synchronous Programming is easy to understand, however, as mobile application development becomes increasingly popular, it is an important topic to make asynchronous programming easier.

 

Therefore, when creating a Metro App, C #'s unique async and await keywords are C #. Compared with C ++ and JavaScript, they are brilliant in asynchronous programming. C ++ and JavaScript are used, executing asynchronous programming means the callback method, or even modifying the entire application kernel. However, the asynchronous programming method provided by C # allows you to write code with the habit of Synchronous Programming, but it is implemented in an asynchronous way.

Of course, too much will not satisfy your curiosity. Let's take a look at the asynchronous programming demonstration demonstrated by the Anders demo. Your future Windows programming will be indispensable.

2. Windows Runtime IntegrationAnders shows that the new Windows Runtime has been deeply integrated. NET and C #, for example, using C # as the "Compute engine" and then outputting the HTML/JavaScript Metro App (just like C ++ ). So you can create a C # project, compile it into a WinMD file, and add it as reference in your HTML/JavaScript project. In this way, you can intelligently obtain the C # object in JavaScript. As Anders said, "You may be lucky for JavaScript programmers, but you will always be lucky for C # programmers ".

3. Caller Info featuresThe Aforementioned Caller info feature has also been published. This is not an invention, but a demo project's code color cleaning disk.

For C ++ programmers, it is very easy to understand macros, but C # programmers are different. So we are thinking of a new way to make C # support macros. We all know that C #4.0 supports optional parameters, So C #5.0 adds the CallerFilePath, CallerLineNumber, and CallerMemberName features. For example, you can write a Trace as follows. writeLine method: public static class Trace {public static void WriteLine (string message, [CallerFilePath] string file = "", [CallerLineNumber] in line = 0, [CallerMemberName] string member = "") {var s = string. format ("{0 }:{ 1}-{2 }:{ 3}", file, line, member, message); Console. writeLine (s );}}

Then, if you want to call Trace. WriteLine ("Something just happened"), the compiler will automatically fill in the remaining optional parameters based on where you call this method. Note that this feature is not available in the Developer Preview and will be unveiled in the final release. As Anders said, this is not a big surprise, but there is no need to doubt that many people will like to use it.

4. The Roslyn (Compiler APIs) ProjectWhen introducing Roslyn, Anders said that we are increasingly addicted to the convenience provided by the IDE, such as searching for references, searching for Symbol, renaming, and extraction methods. But common sense tells us that the premise is that the Code must be locked in the compiler.

Roslyn is a built-in API compiler. Its output is like the code compiler of the current project. It includes the syntax tree API, tag API, bind the analysis flow API, and issue API. These APIs are based on modern API design principles.

All of the above features can be used in middle October. When Visual Studio Roslyn's CTP version is released, C # and VB APIs can be used normally.

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.