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 the difference between public, static, and void?
Can an abstract class inherit from another abstract class c#?
What does ienumerable mean?
What is xor operator in c#?
What is the difference between interface and inheritance in c#?
When do you generally use a class over a struct?
Can I fly with a loop recorder?
What is difference between function and method in c#?
What is the do while loop code?
Why do I get an error (cs1006) when trying to declare a method without specifying a return type?
How many static constructors are allowed in a class?
What is virtual in c#?
How do you sort a list in c#?
What are All kind of access specifiers for a class and for methods
Why do we use lambda expression in c#?