
How can I make global variables known in c# syntax editor?
For Example to write:
var result = myGlobalVar + 10;
How can I make global variables known in c# syntax editor?
For Example to write:
var result = myGlobalVar + 10;
Hello,
Global variables aren't really a supported feature in object oriented C#. Is your editor just editing the interior of a method (via use of header/footer text like in our Code Fragments QuickStart) or full C# (namespace, class, etc.)? If it's just the interior of a method, you could declare the variable in the HeaderText and it would be available in IntelliPrompt.
I'm using Microsoft.CodeAnalysis.CSharp.Scripting.CSharpScript, which allows me to specify a globalsType in the Create method.
The idea with code fragments also solves the problem, thanks.
Please log in to a validated account to post comments.