fbpx

SELF not available in field declaration

More
4 months 3 weeks ago #1 by Mathias Koch
SELF not available in field declaration was created by Mathias Koch
Hi,

the following construct compiled and worked in Vulcan.NET:
CLASS GapCockpitShellWindow INHERIT GapShellWindow IMPLEMENTS IGapCockpitShellWindow
        PRIVATE activatedEventHandler := EventHandler{SELF, @ActivatedShell()} AS EventHandler

The X# compiler gives me an error:
Error XS0027 Keyword 'SELF' is not available in the current context

Is this intended?

Please Log in or Create an account to join the conversation.

More
4 months 3 weeks ago #2 by Robert van der Hulst
Replied by Robert van der Hulst on topic SELF not available in field declaration
Mathias,
This is a side effect from the fact that we have used Roslyn as compiler engine. C# also does now allow you to use "this" in places like this.
You should have no problem if you move the initialization of the event handler to the constructor of the class.

Robert

XSharp Development Team
The Netherlands
This email address is being protected from spambots. You need JavaScript enabled to view it.

Please Log in or Create an account to join the conversation.

More
4 months 3 weeks ago #3 by Mathias Koch
Replied by Mathias Koch on topic SELF not available in field declaration
OK, thanks.

Please Log in or Create an account to join the conversation.