Code Snippets

14116418_s

You can use code snippets to type a short alias, and then expand it into a common programming construct. For example, the for code snippet creates an empty for loop

  • Follow this guide to create a Code Snippet in Visual Studio.
  • Snippets are even easier to create and more efficient, with Resharper Live Templates

I have included my favorite snippets:

  • nUnit test method
    
    [Test]
     public void $UnitOfWork$_$StateUnderTest$_$ExpectedBehavior$()
     {
        $END$
     }
    
    
  • Log4net code to be used in every class
    
    private static readonly log4net.ILog log =
     log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
    
    

Leave a Reply

Your email address will not be published. Required fields are marked *