Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the escape code for square brackets in a C# code snippet?

trying to write a VS2010 C# code snippet that has a closing square bracket as part of new object array assignment, basically so:

<Code Language="CSharp">
<![CDATA[public void $MethodName$($parameters$)
{
    if(InvokeRequired)
    {
        ZPICD icdzp = new ZPICD($MethodName);
        Invoke(icdzp, new object[] { });
    }
    else
    {
        $selected$
    }
}
public delegate void ZPICD();]]]>
</Code>

doesn't look like there is a lot on the subject, both bing and google are giving weak results for searches like: escape square brackets in C# snippet C# snippet square brackets C# code snippet square brackets

like image 328
stackuser83 Avatar asked Mar 14 '26 13:03

stackuser83


1 Answers

There is no need for square bracket escape codes, the parser looks to be keeping track of the square bracket depth level through the body of the snippet. The problem was a missing replacement token delineator.

like image 142
stackuser83 Avatar answered Mar 17 '26 02:03

stackuser83



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!