I have an array of variants. Inside that array I have instances of different classes, and I need to analyse each one of them.
How can I get the type of an element, and if it contains an instance of a particular class ?
For example, let’s assume that we have three classes named Tom, Dick and Harry. I could initialize an array of variants this way:
Dim listOfObjects() As Variant listOfObjects.Append(New Tom()) listOfObjects.Append(New Dick()) listOfObjects.Append(New Harry())
In this case, how can I detect if listOfObject(2) contains an instance of Tom, Dick or Harry ?
In VB.NET I could write something like this:
If listOfObjects(2).getType() Is GetType(Tom) Then ... Else If listOfObject(2).getType() Is GetType(Dick) Then ... End If
But I don’t know how to write a similar piece of code in Xojo.