Home > DeveloperSection > Interviews > Can we store multiple data types in System.Array?

Posted on    October-29-2010 12:00 AM

 Visual C++ Visual C++ 
Ratings:
 2 Answer(s)
  4682  View(s)
Rate this:

Amit Singh

Total Post:565

Points:2825
Posted on    October-30-2010 12:00 AM

No, we can not store multiple data types in System.Array

Reason:
System.Array store only similar type of data for example integer type defined array store only int type data.
it is type safe.

we use collection object like ArrayList etc for storing multiple type of data


Rajesh Goswami

Total Post:85

Points:425
Posted on    November-08-2010 1:00 AM

Yes you can, if you have an object array. since System.Object is the base class of all other types, an item in an array of Objects can have a reference to any other type of object.

Don't want to miss updates? Please click the below button!

Follow MindStick