Two Dimensional Array With String In C Sharp
using System;
class TwoDimensionalArrayWithString
{
static void Main()
{
Array names = Array.CreateInstance( typeof(String), 2, 4 );
string str;
int items1 = names.GetLength(0);
int items2 = names.GetLength(1);
for (int i = 0; i < items1; i++)
{
for (int j = 0; j < items2; j++)
{
Console.Write("Enter value for " + i + "," +j+ "\t");
str = Console.ReadLine();
names.SetValue(str,i, j);
}
}
for (int i = 0; i < items1; i++)
{
for (int j = 0; j < items2; j++)
{
Console.WriteLine(i + "," + j + ": " + names.GetValue(i, j));
}
}
}
}
-------------------------------------------------------------------------------------------------------
Two Dimensional Array With String In C Sharp
Reviewed by Baljeet Singh
on
22:56
Rating:
No comments: