Sdílet prostřednictvím


Understanding Code Snippets

Traditionally, application developers have either maintained their own stashes of code samples or spent time searching the help files to find an example of doing a specific task. Developers were looking to find similar examples of doing something that they could then either replicate or use as a template to solve a problem they were having or a task they needed to accomplish. Many times these samples were either linked to in specific help samples, or were left in text files stored in a variety of places like email. The problem was that it wasn’t easy to locate them and then reuse them. Additionally, sharing the code between developers was difficult to do and rarely happened. Visual Studio 2005 introduces a new technology that is designed to solve this problem. IntelliSense Code Snippets are designed to help, organize, maintain and share these types of Code Snippets. By default when Visual Studio is installed, it contains a variety of pre-defined code snippets that are ready to use.

 

By definition a code snippet is actually an XML file with a .snippet extension stored in a specific directory structure. The combination of this structure and the XML enable the Visual Studio IDE to manage and integrate the snippet process directly into the development process. Each snippet is designed to perform an entire function. The management features within the Visual Studio IDE enables additional snippets to be added, edited or deleted. This not only enables individual developers to manage their samples, but also share these within a team based environment. In this video I take a look at this technology and explore how it can be used.

 

<View Understanding Code Snippets>

Comments