Overview

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.

HM_clip0084

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".

HM_clip0085

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

HM_clip0086

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

HM_clip0087


Was this article helpful?