Skip to content

How to create an array element that store multiple data types

krishna balla

Asked Feb 16, 2007, 12:36 AM EST1 answer
Share
LinkedInX

I want to create an array element that store multiple data types, for example

I'm using Object[] mult_type = new Object[4];

How can I go about to do that in storing different type of objects and
retrieve
 the objects back into it's original states?

data type index
 String 0
 int 1
 long 2
 short 3

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0

    Im not sure if you can do this in C#, but I'm pretty sure in C++ you can define the type as void and then when you insert things, you can cast them as (void).

    I am not at all sure if this actually works... but an idea...

    0