Constructor
Description
When inside a class, generates a constructor for the current class
Usage
(Inside class) c
Example
Source Code
<?xml version="1.0" encoding="utf-8"?>
<Commands xmlns="http://schemas.devprojects.net/AutoCode/v4.0">
<Command name="Constructor" version="1.0">
<CommandBehavior>
<CommandLine shortcut="c" />
<ActiveDocument extensions=".cs"/>
</CommandBehavior>
<CommandInfo>
<LanguageCategory>CSharp</LanguageCategory>
<Category>Members/Constructors</Category>
<Usage>(Inside class) c</Usage>
<Description>When inside a class, generates a constructor for the current class</Description>
<Author>DevProjects</Author>
<HelpUrl>http://help.devprojects.net/gallery/command/constructor</HelpUrl>
</CommandInfo>
<CommandCode language="csharp">
<BeforeExecute>
<![CDATA[
if(!CodeHelper.IsInsideClass())
{
CommandHelper.InvalidPosition("To execute this command, the cursor must be inside a Class.");
return false;
}
return true;
]]>
</BeforeExecute>
<Codes>
<Code id="Code1" codeElement="Selection" codePoint="StartOfSelection">
<![CDATA[public <#=GetCodeElement(CodeElementTypes.Class).Name#>(]]>
</Code>
<Code id="Code2" codeElement="Code1" codePoint="EndOfElement">
<![CDATA[)
{
}]]>
</Code>
</Codes>
<!-- Formats the rendered code; from the beginning of 'Code1' until the end of 'Code2' -->
<SmartFormat>
<Start codeElement="Code1" codePoint="StartOfElement" />
<End codeElement="Code2" codePoint="EndOfElement" />
</SmartFormat>
<!-- Positions cursor at the end of 'Code1', inside the parenthesis -->
<Selection codeElement="Code1" codePoint="EndOfElement" />
</CommandCode>
<Signature><![CDATA[
oIZwj/sQQnysQQH9r1BLGCBoj3pC5jvPpI6iQ0cMwtjReWVTMy6Sjj2YG
8scQ7zj5xrdvGYcgZ94BTvvrm4Sb/GQYohl2IOrtjNxReyQX5wRSHNZNG
HUOKQQCR5EkCYfnaQriCLFYimY7BpyXKc15rXkkzdAXysSYBBK4dc2xxU=
]]></Signature>
</Command>
</Commands>