I'm trying to write a vs code snippet that will take the selected and surround it with an if null check, i.e.
accgrp.CREATEDATE = DateTime.Now;
will become:
if (accgrp.CREATEDATE == null)
{
accgrp.CREATEDATE = DateTime.Now;
}
I've got as far as the below. $selected$ only seems to work the last time it is used, if used more than once, the other instances where you would expected to see the selected code are blank. I understand the code below wouldn't do exactly what I want, as I wont get the right hand side of the assignment, btu it would be good enough.
<Declarations>
<Literal>
<ID>expression</ID>
<ToolTip>Expression to evaluate</ToolTip>
<Default>o</Default>
</Literal>
</Declarations>
<Code Language="csharp"><![CDATA[if ($selected$ == null)
{
$selected$ = $expression$$end$
}]]>
</Code>
Can anyone help?