Prepare
Practice
Interview
Aptitude
Reasoning
English
GD
Placement papers
HR
Current affairs
Engineering
MCA
MBA
Online test
Login
Online Practice Test
>
Csharp.NET
« Previous
Next »
Can you store multiple data types in System.Array?
Options
- No
- Yes
CORRECT ANSWER : Yes
Discussion Board
can we store multiple datatypes in system.array ?
We can store multiple dataypes in System.array.
object[] abc= new abc[5];
if we declare object data type array.
Devendra Nagayach 10-26-2017 01:19 PM
can we store multiple datatypes in system.array ?
yes ,we cannot store multiple data types to array .
we do this to arraylist not to array.
array store homogenous types of data i.e have samedatatype .
anju singh 07-9-2017 02:53 AM
Array
Array is belong to System.Array namesapace.
Array store only single datatype.
Example-
string [] name= new name[2];
name[0]="Suman";
name[1]="Sonu";
Suman Kumar 01-24-2017 06:46 AM
The answer is yes.
Yes you can. Check this out:
object[] array = new object[2];
array[0] = new Cat();
array[1] = new Dog();
There you go, I just did it. One object of type Cat and one object of type Dog.
Matthew 04-26-2016 02:42 PM
The answer is NO!
Actually, the answer should be NO. When you declare an array as "new object[x]", you are not "storing multiple data types", you only have objects. That those objects may be int, string, etc., is immaterial.
for Example: foreach(object obj in arrayOfObjects) { }. As you see you are working with single data type "object", which can be converted to other data types.
Irakli 08-10-2015 04:08 AM
Can you store multiple data types in System.Array?
Ideally Yes.
If you create Array of object.Then its possible to store any datatype with it as object is the base class.
But practically, you should not do that
Hitesh 03-4-2015 01:01 AM
Store multiple data in System.array
1> ARRAY belongs to System.array
2> ARRAYList belongs to System.collection
arraylist can hold multiple types of data, but array don't.
So Answer is NO
Maloy Kirtania 01-15-2015 05:10 AM
Discuss
Answer:
No, If the System.Array is of Some Particular Data Type.(Primitive Data Type)
yes, If the System.Array is of Object Type.
Ex :
create an array of objects.
int in = 50;
string st = "Fifty";
object [] obj = new object[2];
obj[0] = in;
obj[1] = st;
Anil Kumar 01-3-2014 10:47 AM
System.Array is not a namespace it is an abstract class
It stores nothing. There are implementations that can store multiple types and there implementations that can't.
The question is garbage.
Sharon 09-20-2013 01:46 PM
arrary list..
yes you can store the multiple data types in arraylist by using c#...
for more information about that you can visit on site..
www.stackoverflow.com
shivani 08-19-2013 11:04 AM
Ans
Yes,U can bcz System.Array class contains Arraylist.
And Arraylist is the collection of multiple data type.
Falgun 08-19-2013 03:47 AM
Multiple data types in an array
I don't think you can store different data types in an array without using an array of references.
Paul 08-9-2013 12:50 PM
can you store multiple data types in system.array?
it says that the answer is yes but i don't think you can store multiple data types in the same array.
jeong 07-12-2013 01:36 AM
« Previous
Next »
Write your comments
Enter the code shown above:
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)
Related Content
ASP.NET (41)
ASP.NET (16)
ASP.NET (16)
ASP.NET for Freshers (19)
ASP.NET for Experienced (19)
ASP.NET (20)
ASP.NET (20)
ASP.NET (25)
ASP.NET (20)
ASP.NET (20)
ASP.NET (20)
ASP.NET (20)
Dot.Net (100)
.NET Framework (26)
.NET Caching (7)
.NET Remoting and webservices (10)
.NET Security (11)
ADO.NET (10)
C#.NET (25)
VB.NET (33)
DOT.NET (10)
C#.NET freshers (20)
C#.NET freshers (20)
C#.NET experienced (20)
C#.NET (25)
C#.NET (20)
Sharepoint (20)
Sharepoint 2007 (15)
WCF (50)
WPF (45)
Advertisement
▲