Answer Posted / sudhir sheoran
The answer is yes and no.
Ideally array is collection of single data types
E.g :-
array [] arr = new int [10];
it will store only int because datatype is defined
as int in this case.
In case of some particular requirements array can be used
to store diff data types. But in this case array has
to be declared as object array
E.g:-
class Test
{
public static void Main()
{
object[] arr = new object[10];
arr[0] = 1;
arr[1] = "Hello";
Console.WriteLine(arr[0]);
Console.WriteLine(arr[1]);
Console.ReadLine();
}
}
This is successfully complied.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
I need code to connect ohter systems in the LAN and i want to display my website image over there and i want explain as a admin through phone. So i need code to access other system using C-Sharp. Any one please help me.Please give me the code. Advace thanks.
how to sort an array in c#
What namespace is list in c#?
What is public or shared assemblies ?
What does a constructor do c#?
What is a string in c#?
What are the advantages of using delegates in c#?
How objects are stored in memory?
Distinguish between continue and break statement?
How to create events for a control? What is custom events? How to create it?
Illustrate the differences between the system.array.copyto() and system.array.clone()?
Does c# support const methods, properties, or events?
What is the difference between structure and class in c#?
How to reduce image resolution in C#?
What is sorted list in c#?