Visual Studio skills

Source: Internet
Author: User

I. xml comments
1. Smart prompts can be obtained during programming. After you write an add () method, you can press "//" on it to automatically extract the "abstract", "parameter", "Return Value", and other content. For example:

When these annotations are defined, a smart prompt is displayed when the method is called. For example:

 

2. ndoc can be used to extract XML comments to form API documents.

 

3. Task Manager
Task Manager is a useful feature. Assume that the project we developed is very large and there are someCodeNot complete. For unit testing, we may use some code to trick the compiler into testing other functional modules in the project. After testing, even if the code is completed, in order to find these code blocks in the future, we can mark them for future search. We can even make some remarks when building the website framework. For example

Result:
If you want to see "// todo is to be improved here", you can use the following method: "View"-"task list" select "Comments" in the task list).

 
2. configure external tools
We may often use some external tools during development, such as ildasm and ilasm. We can configure them as a menu item of Visual Studio and click it to open it as needed, you do not have to find the location of the file every time and then double-click to open it. The configuration process is as follows: Find "Tools"-"external tools" on the toolbar, for example:
Select the file path in "command.

 

Iii. Code segment Manager
The so-called code segment is some code with fixed formats. Except for the difference in some details, most of the formats are the same. For example, to define an attribute for a class, you generally need to define a private variable, and then add the get or set method or both. In our work, it is inevitable that we often do these boring jobs, but in Visual Studio, Microsoft provides us with a convenient operation to reduce the boring work. For example, if we want to add a property, the following smart prompt will appear when we press PR:
On "prop", Press enter and type the tab key to insert the corresponding code segment.

The predefined code segment is located in the [system partition]: \ Program Files \ Microsoft Visual Studio 10.0 \ Vc # \ snippets \ 1033 \ Visual C # folder.

If we feel that the predefined code segment cannot meet our requirements, we can customize the code segment, which can be used like the predefined code segment. To customize a code segment, perform the following operations:

Open a pre-defined code segment. For example, when I open "for. snippet", the following content is displayed:

For. snippets

<? XML version = "1.0" encoding = "UTF-8" ?>
< Codesnippets Xmlns = "Http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet" >
< Codesnippet Format = "1.0.0" >
< Header >
< Title > For </ Title >
< Shortcut > For </ Shortcut >
< Description > Code snippet for 'Loop </ Description >
< Author > Microsoft Corporation </ Author >
< Snippettypes >
< Snippettype > Expansion </ Snippettype >
< Snippettype > Surroundswith </ Snippettype >
</ Snippettypes >
</ Header >
< Snippet >
< Declarations >
< Literal >
< ID > Index </ ID >
< Default > I </ Default >
< Tooltip > Index </ Tooltip >
</ Literal >
< Literal >
< ID > Max </ ID >
< Default > Length </ Default >
< Tooltip > Max length </ Tooltip >
</ Literal >
</ Declarations >
< Code Language = "CSHARP" > <! [CDATA [ For (INT $ index $ = 0; $ index $ <$ Max $; $ index $ ++)
{
$ Selected $ end $
} ]>
</ Code >
</ Snippet >
</ Codesnippet >
</ Codesnippets >

 

modify the corresponding parameters. Here, we will briefly introduce the following parts:
shortcut cut: shortcut key, you can use this code snippet by typing the tab key in the code.
Description: Description of the code segment.
author: the author of the code snippet.
code language = "CSHARP": indicates the code segment of the C # language.
: code snippet. When you use a shortcut key, the code is inserted at the cursor.
$ end $: this is a special parameter used to specify the position of the cursor after the user fills in the content in the code segment field and presses enter.
$ selected $: this is a special parameter that only makes sense for a surroundswith-type code segment.

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.