Hi Everybody,
I have a funtion named IterateThroughChildren() and I want to write the code to emit the code from inside of that function.
Normally the code block is included inside <# #> and custom functions are included inside <#+ #>, we emit our code inside <#= #> block. What if I want to recursively execute the above mentioned function and based on some logic I want to emit the code i.e.
e.g
<#
//Code to get child and parent data
IterateThroughChildren(object child, object parent);
#>
<#+
void IterateThroughChildren(object c, object p)
{
if(c is abc)
{
if(p is def)
{
//emit some code here i.e WriteLine(SomeThing); ?????
foreach (var item in def.Item)
{
IterateThroughChildren(item, def);
}
}
}
. . .
//and so on
}
#>