Multimobile Development: Building Applications for any Smartphone
VARIANT array
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.sdk.


Arr S
GOOD ANSWER
I need to use a VARIANT array. But, I am not sure whether it's available in C#. I found a VARIANT API in the platform SDK (in the OleAuto.h file). Is this is the right one that I've to use? If so, how to include this .h file?

Thanks in advance,
Arr S.
Reply to this message...
Vote that this is a GOOD answer... (1 vote from another user already)
 
 
    
Andreas HÃ¥kansson
GOOD ANSWER
Arr,

You should use an array of objects. The Object class is the base class
for
everything in .NET, just like Java uses.

object[] myArray = new object[10];

myArray[0] = 1;
myArray[1] = "Something";
myArray[2] = true;

Not that implicit type casting is taking place. That is all of your other
varaibles,
be it an int, string, bool or anything else, will be converted into an
object and if
you need to get it back you will have to perform explicit type casting

int a = (int)myArray[0];
string b = (string)myArray[1];
bool c = (bool)myArray[2];

Hope this helps,

//Andreas

"Arr S" <Click here to reveal e-mail address> skrev i meddelandet
news:Click here to reveal e-mail address...
[Original message clipped]

Is this is the right one that I've to use? If so, how to include this .h
file?
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer... (1 vote from another user already)
 
 
    
Arr S
GOOD ANSWER
I am developing a DLL that will be used by applications. These applications pass the data as VARIANT array. In this case, I'll not be knowing the data type of the object sent. Only VARIANT array can help my problem,I suppose. Is their any other way?

Thanks Andreas.

Reply to this message...
Vote that this is a GOOD answer... (1 vote from another user already)
 
 
 




Multimobile Development: Building Applications for any Smartphone
Ad
BootFX
Reliable and powerful .NET application framework.
iOS, Android and Windows Phone Development Training and Consultancy
Hosted by RackSRV Communications
 
Multimobile Development: Building Applications for any Smartphone
Copyright © AMX Software Ltd 2008-2010. Portions copyright © Matthew Baxter-Reynolds 2001-2010. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - 4.0.30129.1734