Let's say I have the following C# class with just a ctor/method:
public class MyClass
{
public MyClass (int param1, Type param2)
{
}
}
I would like from that point to generate 3 code snippets from a method's parameter information. E.g set the cursor on one of the parameters, bring the right click menu and use some added items from there with the functionality as follows.
public class MyClass
{
// First code I want to generate, just after the class signature - "Generate private field"
//
private int _param1;
private Type _param2;
public MyClass (int param1, Type param2)
{
// Second code snippet - "Generate verification and assignment"
//
if (param2 == null)
throw new ArgumentNullException ("param2");
_param1 = param;
_param2 = param2;
}
// Third code snippet after the method's body - "Generate Property"
//
public int Param1 {
get { return _param1; }
set { _param1 = value; }
}
public Type Param2 {
get { return _param2; }
set { _param2 = value; }
}
}
All good, but I don't have a clue how to do that. I read the Slick-C manual but that was just an overview of the language and some UI design features of SlickEdit. Is there a tutorial and examples on code generation and parsing/using tag information?