How do you make a shared method/property in Xojo like you can in vb.net? Is making a ‘shared’ method/property in xojo not useful. Thanks in advance.
You just add a Shared Property, Shared Computed Property or a Shared Method to a class. It is useful in Xojo (as in other languages) for situations where you do not want/need to instantiate an object but want access to its class related state or functionality.
So it works like a module?
I am not really a ‘VB man’ but from my recollection - No - modules in VB were not related to any class and were a kind of legacy left over from the VB6 days. They allowed you to code a set of functions that did not have the context of a class to contain them they were global functions (and data). You can achieve the same effect by just coding a class in Xojo and adding shared (static in other languages) methods and properties. You probably want to think about why you would want to organise your code this way though, if you were porting a function library from another language then it may be the easiest way but if you are creating something new then your shared methods and properties should have some clear context i.e Car shared methods in a Car class, Person shared methods in a Person class etc.