c# error: Use of unassigned local variable (context visual studio T4 ENGINE)
- by user310291
In C# (within the context of T4 template see http://www.olegsych.com/2008/03/how-to-generate-multiple-outputs-from-single-t4-template/) I want to do this
<# String myTemplateVar;
#>
<# if (string.IsNullOrEmpty(myTemplateVar)) {
myTemplateVar= "name";
};
#>
I want to give a value to myTemplateVar if myTemplateVar has not already been setup by an external call from T4 engine in another template which would have this instruction:
CallContext.SetData("myTemplate.myTemplateVar", ExternalTemplateVar);
But I cannot even compile in C# why ? How to fix this ?