How can I make global variables known?

SyntaxEditor for WPF Forum

Posted 2 months ago by Manfred Rosskamp
Version: 25.1.0
Avatar

How can I make global variables known in c# syntax editor?

For Example to write:
var result = myGlobalVar + 10;

Comments (2)

Posted 2 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

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.


Actipro Software Support

Posted 2 months ago by Manfred Rosskamp
Avatar

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.

The latest build of this product (v25.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.