Expanders are a very important piece in the architecture of CodeStencil. They form a repository of labels and the strings defined to replace those labels during code generation.

You can define as many labels as you want to use for string replacement.


Expanders consist mainly of:

  • Expansion Label - This is the label you insert in your stencil
  • Expansion String - Replacement string
  • Delimiter - Character to delimit multiple strings

Using Expanders

Here is a quick example of using Expanders:

(a) We want to Expand a label called "NameSpace". This will expand into "ZeraSystems.CodeStencil".


(b) Drag a label from the Expanders Grid and drop it into the Code Editor. Note that the Expansion Label is automatically enclosed with "[%%]


(c) Generate the code to see the string replacement in the generated file.


Was this article helpful?