简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM