Wrapping user's source with my own header/footer

SyntaxEditor for Windows Forms Forum

Posted 4 years ago by Daniel Earwicker
Version: 14.1.0323

I'd like to offer my users the ability to use C# or VB.NET as if they were scripting languages. In simple terms I mean that the user would enter code that is effectively just the body of a method.

I would then wrap that in auto-generated class/method declaration to produce compilable source.

But I want the Actipro editor to do all the great intellisense/autocompletion stuff. Hence I need the editor to analyse the code as if it was wrapped in the class/method declaration, but not display the wrapper code.

So the user just writes/sees:

log.WriteLine("Hello world");

For compilation I would wrap that as follows:

public static class UserScript
    public void UserMethod(TextWriter log)
        log.WriteLine("Hello world");

The user should get intellisense etc. when they type log because it's declared as a parameter to the wrapper method.

Is this possible with Actipro?

Comments (1)

Answer - Posted 4 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Daniel,

Yes, we fully support that.  Please see the Code Fragments QuickStart in the Sample Browser project.  It shows exactly how to achieve this scenario using SyntaxEditor and the .NET Languages Add-on.

Actipro Software Support

The latest build of this product (v2018.1 build 0341) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.