Hi folks, is it possible to store multiple datatypes in an array, if not, what could the reason be?
TIA
Hi folks, is it possible to store multiple datatypes in an array, if not, what could the reason be?
TIA
You can store anything you like in an array of objects, but doing so makes me wonder about your design.
Yes.
You can make an object[]
and put anything you want inside of it.
However, you probably shouldn't.
What are you trying to do?
If you declare your array as an array of object
then, yes you can store anything in it. You'll have to cast to the desired type when you use it though. I think you really need to understand the concept of type-safety to get your head around why this is a bad idea in most languages.