Expanders

<< >>

Navigation:  CodeStencil >

Expanders

 

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

 

 

 

 

tog_plusUsing 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 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

 

Code Nanites are also used the same way. The only difference is that during code generation, the actual code is called and executed. This code can be anything from generating more complicated strings or even uploading a file to FTP.