New topic: 

Using Introspection.GetType on an array?

<http://forums.realsoftware.com/viewtopic.php?t=46127>

         Page 1 of 1
   [ 3 posts ]                 Previous topic | Next topic          Author  
Message        x11joex11          Post subject: Using Introspection.GetType on 
an array?Posted: Mon Dec 03, 2012 8:33 pm                         
Joined: Thu Oct 12, 2006 7:21 am
Posts: 408
Location: California                I have the following code I'm trying to run 
that does not compile.

Dim arrayTypeInfo As Introspection.TypeInfo = introspection.GetType(theArray)

theArray is an array of variants.  I'm aware that GetType requires an object as 
it's parameter and therefore that is why this does not compile, but I need to 
find a way to get the type of the array.

If the array had instantiated items in it I could say theArray(1) and this 
would work, but my object is not instantiated at the time I need to check it, 
and I have no idea of knowing what kind of 'object' I need to instantiate at 
the time.

Is there a way to figure out the type of the array without sending an 
instantiated object?      
_________________
Joe Astrahan
CEO - iTechware Inc.
iTechware - Internet, Technology & Software
Google Adwords Campaign Management
"Rocketing you to the top!"
10900 Los Alamitos Blvd, Suite #210
Los Alamitos, CA, 90720
(949)354-4ADS  
                             Top                x11joex11          Post 
subject: Re: Using Introspection.GetType on an array?Posted: Mon Dec 03, 2012 
9:52 pm                         
Joined: Thu Oct 12, 2006 7:21 am
Posts: 408
Location: California                Great, I think I just got it to work 

paramters passed to my function are:

byref arrayNode as xmlnode, theArray() as Variant,byref arrayPropertyInfo as 
Introspection.PropertyInfo

dim arrayElementType as Introspection.TypeInfo = 
arrayPropertyInfo.PropertyType.GetElementType()
dim arrayElementContructorInfo() as Introspection.ConstructorInfo = 
arrayElementType.GetConstructors()


Doing this allowed me to get the element type of the array and even the 
constructors so that I could run the invoke method to create instances , 
working great so far, can't wait to show you guys what I made.      
_________________
Joe Astrahan
CEO - iTechware Inc.
iTechware - Internet, Technology & Software
Google Adwords Campaign Management
"Rocketing you to the top!"
10900 Los Alamitos Blvd, Suite #210
Los Alamitos, CA, 90720
(949)354-4ADS  
                             Top                doofus          Post subject: 
Re: Using Introspection.GetType on an array?Posted: Tue Dec 04, 2012 10:15 am   
                              
Joined: Thu Sep 10, 2009 2:50 am
Posts: 314
Location: Santa Cruz, CA, USA                I've never been able to do this.

But I'd like to. Playing with your code I can't figure out where the 
arrayPropertyInfo parameter comes from. Starting with a Variant containing an 
object array I've tried several ways to get a PropertInfo from it but none are 
useful. Can you share more code please, I've seen this come up before but never 
a solution. (Maybe its a fixed bug from my old rB)   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 3 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to