Saturday, 22 March 2014

code snippets in c#

Basically custom snippets save in .snippet file, it is XML based file, and we can manually create this XML file in a snippet acceptable format and add it into Visual Studio IDE

1.      Adding custom snippet to VS2010.
2.      Click on Tools à Code Snippet manager [ctrl + k, ctrl + b]
3.      Adding New code snippet by clicking to Import
4. Choose the location for it by;
4.      Shortcut which you have given in snippet file just type there
5.      It displaying on your snippet window like below
6.      By typing it fully your code come in editor;
code snippet sample
xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="">
  <CodeSnippet Format="1.0.0">
        Code snippet for Commenting the code
          <ToolTip>User Story Id</ToolTip>
          <ToolTip>Created By</ToolTip>
          <ToolTip>Created Date on</ToolTip>
      <Code Language="csharp">
/// User Story detail - $USID$
///Created By - $CreatedBY$ on Created Date  - $CreatedOn$

No comments:

Post a Comment