Can you store multiple data types in System.Array?
Answer Posted / vishal
Ok, so here is the catch:
An array of objects can store different datatype members -
object[] ar = new object[3];
ar[0] = "test";
ar[1] = 56;
An arraylist can also be used for this purpose -
ArrayList arr = new ArrayList();
arr.Add(56);
arr.Add("ASDf");
And a generic list too can be used for this purpose -
List<object> llst1 = new List<object>();
llst1.Add(56);
llst1.Add("ASDf");
| Is This Answer Correct ? | 6 Yes | 1 No |
Post New Answer View All Answers
Explain states of a thread in c#?
If a method's return type is void, can you use a return keyword in the method?
What is a struct in C#?
What does console readline do?
Explain about accessibility modifier 'protected internal'?
Whats an assembly? Describe the importance of assembly?
What is the difference between null and string empty in c#?
What is console readkey in vb net?
What is the do while loop code?
Can we inherit private class in c#?
What is cookies in c# asp net?
What is public void in c#?
What is byte c#?
What is array and types of array in c#?
Why array is faster than arraylist in c#?