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?

Answer Posted / alok yadav

Yes, its possible try the below sample
replace manageAdvertisement with your class

System.Array ar=Array.CreateInstance(Type.GetType
("System.Object"),3);
ar.SetValue("asdfas",0);
ar.SetValue(1, 1);
ManageAdvertisement mg=new ManageAdvertisement();
mg.AdvertisementDesc="123124";
ar.SetValue(mg, 2);
foreach (object obj in ar)
{
Response.Write( obj.GetType() +"<br>");

}

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is getenumerator?

802


What is difference between private and static constructor?

866


What is the system namespace?

848


What is the difference between hashtable and dictionary?

904


How do I join one form to another in c#?

863


Explain what are three test cases you should go through in unit testing?

877


Is array ienumerable c#?

819


What is Implementation inheritance and interface inheritance?

928


What is private and shared assembly?

936


Can a class or a struct have multiple constructors?

898


What are c# collections?

839


Explain constructor in c#?

1245


How many bytes is an int c#?

832


Can a struct inherit from another struct or class in c#?

860


What are the Types of caching

965