X# syntax for constructor chaining

Have some feedback and input to share?
Don't be shy and drop us a note. We want to hear from you and strive to make our site better and more user friendly for our guests and members a like.
Post Reply
User avatar
pemo18
Posts: 76
Joined: Fri Apr 27, 2018 10:38 am
Location: Germany

X# syntax for constructor chaining

Post by pemo18 »

Hello X# Community,

I would like to use constructor chaining that means one constructor in a class should call another constructor with different arguments.

I found an old post by Robert from 2016.

So is calling Self() still the only option?

I would prefer the C# style like:

Constructor(strDateiname As String) : Self()

But its not urgent since right now I am using a second parameter with a default value.

Kind regards,
Peter
User avatar
robert
Posts: 4290
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

X# syntax for constructor chaining

Post by robert »

Peter,
The C# syntax is not allowed.
What we allow is:

Code: Select all

Constructor(strDateiname As String) 
Self()
What you could do (using the ; statement delimiter)

Code: Select all

Constructor(strDateiname As String)  ; Self()



Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Post Reply