Bagikan melalui


Code Snippets Manager

In Visual Basic, Visual C#, and SQL projects, and in HTML, XML, and JScript files, you can use the Code Snippets Manager to add folders to the folder list that the Code Snippet Picker scans for XML .snippet files. Having these building blocks of code at your disposal can facilitate project development.

The Code Snippets Manager can be accessed from the Tools menu. For more information, see How to: Manage Code Snippets.

  • Language
    Selects the development language whose code snippet folders are displayed in the folder list.

  • Location
    Displays the path to the folders in the folder list, or to the code snippet file selected there.

  • Folder list
    Shows the set of subfolders, if any, and the code snippet files available for the Language selected. Click any folder to expand it and list its files.

  • Description
    Displays information on the folder or code snippet file selected in the folder list. When a code snippet file is selected, displays the text from its Author, Description, Shortcut, and Type fields.

  • Add
    Opens the Code Snippet Directory dialog box. Allows you to navigate to the desired snippets folder on your local drive or server, and include it in the folder list.

  • Remove
    Removes a selected top-level folder and its contents from the folder list. Does not physically delete the folder.

  • Import
    Opens the Code Snippet Directory dialog box. Allows you to navigate to the desired snippet on your local drive or server, and add it to an existing code snippet folder.

Security

Whenever you store a new snippet in a folder accessed by the Code Snippets Manager, you are responsible for ensuring that its code is constructed as securely as the rest of your application. Because using code snippets saves development time, snippets can be reused frequently as you construct applications. You should therefore make sure that model code saved in snippets is designed to address security issues. Development teams should establish procedures to review code snippets for compliance with general security standards. For further information on code security, see Security in Visual Studio and Secure Coding Guidelines.

See Also

Tasks

How to: Manage Code Snippets

How to: Modify Existing Snippets

How to: Debug Code in the Editor

Reference

Code Snippet Picker

Concepts

Visual Basic IntelliSense Code Snippets

Other Resources

Setting Bookmarks in Code

How to: Search for Code Snippets Online