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
What is getenumerator?
What is difference between private and static constructor?
What is the system namespace?
What is the difference between hashtable and dictionary?
How do I join one form to another in c#?
Explain what are three test cases you should go through in unit testing?
Is array ienumerable c#?
What is Implementation inheritance and interface inheritance?
What is private and shared assembly?
Can a class or a struct have multiple constructors?
What are c# collections?
Explain constructor in c#?
How many bytes is an int c#?
Can a struct inherit from another struct or class in c#?
What are the Types of caching