In Visual Studio you can use code snippets e.g. when your are editing a class you can type ctor and the default constructor will automaticly be added to your class.
Is it possible to create a code snippet in Visual Studio, that does the following:
- Creates the get/set
Loggerproperty where the cursor is. - Adds
using Castle.Core.Logging - Lets me choose where in the list of instance variables I can place
private ILogger _logger = NullLogger.Instance;.
public class Person
{
private string name;
private int age;
public Person()
{
}
// cursor is here and you type "logger"
}
After you type logger visual Studio adds the following code:
using Castle.Core.Logging; // Added by code snippet
public class Person
{
private string name;
private ILogger _logger = NullLogger.Instance; // Added by code snippet
private int age;
public Person()
{
}
// Added by code snippet
public ILogger Logger
{
get { return _logger; }
set { _logger = value; }
}
}