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
Why do we need constructors?
Why do we need constructor in c#?
What is a int in c#?
What is a view? What is the use of it?
Is a valid int value?
Can you mark static constructor with access modifiers?
Why we use extension methods in c#?
What type of data type conversion happens when the compiler encounters the following code?
Is comparator a functional interface?
Explain the different ways a method can be overloaded?
Explain how do you convert a value-type to a reference-type?
How does a while loop work?
Is concurrent queue thread safe?
Explain how is the dll hell problem solved in .net?
What is difference between internal and protected internal in c#?