10 new features that resolve visual Studio 2015 for productivity

Source: Internet
Author: User

1 Performance Tips Performance Tips

When we want to know the time spent executing a piece of code, we need to use the stopwatch class of the. NET framework, like this:

class Program
{
    Static void Main ()
    {
        Create New Stopwatch
        New Stopwatch ();
        Begin Timing
        Stopwatch. Start ();
        Do something  here is the time-consuming code that needs to be tested
         for (int i = 0; i <; i++)
        {
            Thread.Sleep (1);
        }
        Stop Timing
        Stopwatch. Stop ();
        Write result
        Console.WriteLine ("Timeelapsed: {0}", stopwatch. Elapsed);
    }
}
We need to manually add the code stopwatch class at the start and end of the code where the test execution time is required, and then view the execution time of the code when debugging.
Visual Studio 2015 introduces new performance hints that, as shown, when you debug a segment code, place two breakpoints, and when you debug to a second breakpoint, Visual Studio displays the execution from the previous breakpoint
The time it takes to execute the breakpoint:
Executes a code call that, after the completion of a code call, can also display the processor time that is spent calling this code:

2 Quick Code Writing tips Quick Action light Bubble Icon

When Visual Studio's IntelliSense background detection code discovers a problem, it prompts the code for a problem and provides a recommended way to resolve the problem. This function is a bit like plagiarism ReSharper, ReSharper early version of this feature. There are two kinds of bubble tips

Syntax error correction

As shown, the activyname variable or attribute is not defined in the current type, so Visual Studio generates three hints for this syntax error:

A adds a variable definition to the current type

B Add read-only variable definitions in the current type

C adding properties to the current type

Code refactoring recommendations

As shown in the code example, the first variable definition resultlist can ignore the definition and replace it directly with Tempresults.tolist () in the second line of code.

In my development environment, the third-party plug-in that was required after the installation of Visual Studio was ReSharper, a feature that appeared early in the ReSharper.

3 Customizing the form layout Window layout

Visual Studio has a default layout scheme, and if you want to go back to the initial interface layout after adjusting the layout several times, you can only call Reset window Layout under the Window menu to revert to the post-installation state.

The layout usually refers to information such as the location, width, location and height of the Output window of the solution browser, which is saved by Visual Studio and retains only the most recent layout.

Visual Studio 2015 introduces a layout-saving scheme that allows users to save these layout information to make it easier to invoke different layout scenarios when switching tasks.

4 Simplifying renaming simplified Rename

When you need to rename a variable, you can right-click the variable name to select Rename or press F2 shortcut, Visual Studio highlights the location of the variable used in the current file with the green Word and displays it in the upper-right corner of the current editor

Other files that refer to this variable can preview the changes after renaming.

This feature can be seen as an improvement in the functionality of renaming variables in Visual Studio refactoring. ReSharper's renaming function is much more convenient than this.

5 breakpoint setting improved break point improvement

Visual Studio has improved the conditional-expression breakpoint-based condition setting interface, as shown in Visual Studio 2013, which displays the classic breakpoint settings interface since Visual Studio was published.

is the conditional expression setting interface for breakpoints in Visual Studio 2015, and when conditions are met, you can also increase the method, as shown in outputting a custom message to the Output window.

For Visual Studio conditional expressions, recommend a very good plug-in, Ozcode, it graphically display the various conditions of expression and its operation results, greatly facilitates the program debugging.

Visual Studio 2015 breakpoints also support undo functionality, and if you accidentally delete a breakpoint, point undo (Ctrl + Z) restores the breakpoint.

6 Error Output improvement Error List improvement

First look at the interface of the error output form in Visual Studio 2013:

Look again at the error output form in Visual Studio 2015:

Visual Studio 2015 adds error codes for compiler compilation errors, such as CS0219 in, which makes it easy to review MSDN's corresponding compilation problems to reproduce to quickly fix error issues.

The code column of the Output window, the beginning of CS, represents a compilation error, and the presentation of the CA begins with the analysis.

7 The Immediate window supports lambda expressions and LINQ queries lambda expression and LINQ support in Immediate Window

When you debug your code, you enter an expression directly in the Immediate window, and Visual studio evaluates the expression and returns the result. The immediate windows for Visual Studio 2015 now support lambda expressions and LINQ queries.

8 NuGet Package Manager improves NuGet Packages Manager improvement

Visual Studio 2015 provides a graphical NuGet package manipulation tool that supports package search, and the option to select a project that needs to be referenced by a package is selectable version.

This improvement will allow NuGet novices to get rid of the fear of being unfamiliar with commands.

9 static referencing of the static using

The Console class has a WriteLine method that can now call the WriteLine method directly in the code without adding the console type name, as shown in:

A bit like the global function of the C + + language, if the WriteLine method is defined in more than one type, and these types have static references (statis using), the compilation will still error.

10 properties or methods use lambda expressions to implement Implement Methods and Properties with Lambda Expressions

Method body is a lambda expression

 Public Override string string. Format ("{0},{1}", x, y);

property is defined as a lambda expression

 Public Double Distance=> math.sqrt (x*x + Y *y);

Resolving 10 new features of Visual Studio 2015 for productivity

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.