Microsoft Dynamics Ax developer's blog

Tuesday, May 23, 2006

Undocumented syntax: raw strings in X++

While reading the Fred Shen post Create a method in runtime i discovered the undocumented feature of X++: raw (or verbatim strings). If you place @ before " you can:

  • do not escape escaping characters

  • make multiline string


so

str s=@"
test\test
";

is equivalent to

str s="\r\n";
s=s+" test\\test\r\n"


so it is useful when you want to make methods or AOT pathes (BTW why Fred uses string for pathers ("\\Forms\\Address\\Data Sources\\Address\\Fields\\AddrRecId") instad of raw strings (@"\Forms\Address\Data Sources\Address\Fields\AddrRecId")

see also

No comments: