Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Can you store multiple data types in System.Array?

Answers were Sorted based on User's Feedback



Can you store multiple data types in System.Array?..

Answer / naveen

Bit tricky answer. Convert into system.object and store
(using boxing)like this you are able to store differnt
types which is not recommended

Is This Answer Correct ?    3 Yes 1 No

Can you store multiple data types in System.Array?..

Answer / guest,naveen

You can try it in your System, by writing a small program.

Is This Answer Correct ?    1 Yes 0 No

Can you store multiple data types in System.Array?..

Answer / joe

Yes and no. Yes you can but it is no longer an array. You
would want to use a Structure. In a way, structures are
better arrays. Look 'em up, they are very handy.

Is This Answer Correct ?    0 Yes 0 No

Can you store multiple data types in System.Array?..

Answer / sudhir sheoran

The answer is yes and no.
Ideally array is collection of single data types
E.g :-
array [] arr = new int [10];
it will store only int because datatype is defined
as int in this case.

In case of some particular requirements array can be used
to store diff data types. But in this case array has
to be declared as object array
E.g:-
class Test
{
public static void Main()
{
object[] arr = new object[10];
arr[0] = 1;
arr[1] = "Hello";
Console.WriteLine(arr[0]);
Console.WriteLine(arr[1]);
Console.ReadLine();
}
}
This is successfully complied.

Is This Answer Correct ?    0 Yes 0 No

Can you store multiple data types in System.Array?..

Answer / guest

No

Is This Answer Correct ?    2 Yes 3 No

Post New Answer

More C Sharp Interview Questions

Is char * null terminated?

0 Answers  


What do you mean by default constructor?

0 Answers   NIIT,


int i = 1; int j = 1; System.Console.WriteLine(i == j); System.Console.WriteLine(i.ToString() == j.ToString()); System.Console.WriteLine((object)i == (object)j); Give the sample code above, what is the output to the console?

5 Answers  


What is difference between iqueryable and ienumerable in c#?

0 Answers  


Why do we need abstract class?

0 Answers  


Explain states of a thread in c#?

0 Answers  


Which is faster abstract class or interface in c#?

0 Answers  


What is a view? What is the use of it?

0 Answers   Accenture,


What is a class level variable in c#?

0 Answers  


Why do we need interface in c#?

0 Answers  


What is new method in c#?

0 Answers  


Why do we parse in c#?

0 Answers  


Categories