Welcome, Guest
Username: Password: Remember me
Share your code snippets, screen shots etc. here
  • Page:
  • 1

TOPIC:

X# Feature: Scoped classes 22 Aug 2019 18:25 #10299

  • wriedmann
  • wriedmann's Avatar
  • Topic Author


  • Posts: 3366
  • Hello,

    it is now the second consecutive day I'm using a language feature that is new to X# (and that maybe most people coming from VO does not knows):
    class MyClass
    ....
      class MyDetailClass
      ...
      end class
    
    end class

    The beauty is that the class MyDetailClass is visibile only in the MyClass itself, and not externally to it.

    I'm using that instead of using multidimensional arrays, and I think this makes code much clearer.

    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

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

    X# Feature: Scoped classes 22 Aug 2019 21:09 #10302

    • robert
    • robert's Avatar


  • Posts: 3599
  • Wolfgang,

    Yes this works. And you can use both List<MyDetailClass> as well as ARRAY OF MyDetailClass syntax

    Robert
    XSharp Development Team
    The Netherlands

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

    X# Feature: Scoped classes 23 Aug 2019 07:10 #10306

    • wriedmann
    • wriedmann's Avatar
    • Topic Author


  • Posts: 3366
  • Hi Robert,

    I prefer the array of MyDetailClass because I can use ASort() and AScan() then - I need both.
    I know that you don't agree, but ASort() and AScan() as so powerful that I have found no corresponding possibility with the List collection class.

    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

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

    X# Feature: Scoped classes 23 Aug 2019 07:22 #10307

    • wriedmann
    • wriedmann's Avatar
    • Topic Author


  • Posts: 3366
  • Hi Robert,

    in my testclass this works:
    class MyExternalClass
    	protect _aData			as array of MyInternalClass
    
      class MyInternalClass
    
      	constructor()
    
      end class
    
    end class

    but unfortunately it gives an error in my real code:
    error XS0310: 'clsTechnikerStatistik.TechnikerStatistikDetail' must be a non-abstract type with a public parameterless constructor in order to use it as parameter 'T' in the generic type or method 'XSharp.__ArrayBase<T>'

    The class TechnikerStatistikDetail has a public parameterless constructor.....
    class TechnikerStatistikDetail
    public constructor()
        self:Aufnr := 0
        return
    
    public property Aufnr as int auto
    end class

    I'm will try to reproduce this in my sample class.

    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

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

    • Page:
    • 1