I have code for a T4 template that has two for each loops, and one is inside the other.
I am having an issue escaping the inner for each and pass data from the parent for each.
The image below demonstrates the variable data I am trying to pass from the parent for each to the child for each.
I have tried:
foreach (var prop in GetPropertiesNameOfClass(#><#=item #><#))
foreach (var prop in GetPropertiesNameOfClass(#>item<#))
when I transform the template it generates an error:
CS1525 error Invalid expression term ')'
CS1002 error ; expected
答案 0 :(得分:3)
You are already inside of <# #>
context, so you does not need any additional escaping to refer to item
variable in your code:
foreach (var prop in GetPropertiesNameOfClass(item))