fbpx
Welcome, Guest
Username: Password: Remember me
Please use this forum for suggestions to the XSharp Development Team
  • Page:
  • 1

TOPIC:

X# syntax for constructor chaining 06 Oct 2020 12:57 #16101

  • pemo18's Avatar

  • pemo18

  • Topic Author


  • Posts: 43
  • 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

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

    Last edit: by pemo18.

    X# syntax for constructor chaining 06 Oct 2020 13:04 #16103

  • robert's Avatar

  • robert


  • Posts: 1908
  • Peter,
    The C# syntax is not allowed.
    What we allow is:
    Constructor(strDateiname As String) 
    Self()

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




    Robert
    XSharp Development Team
    The Netherlands

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

    • Page:
    • 1