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 attribute and reflection in c#?
What are jump statements in c#?
Is null == null c#?
What is the difference between static and constant variables?
How do I calculate relative time?
What is the difference between do and while loop?
Difference between StackPanel and RelativePanel ?
How to use delegates with events?
What operator means?
Explain the differences between static, void and public in c#?
Can class inherit from struct c#?
What does immutable mean in c#?
What does int32 mean?
Why do I get a syntax error when trying to declare a variable called checked?
Explain “static” keyword in c#?