Hi,
Is there any function (inbuilt) which print all the elements of the Array.
I need to print or see what an array contains and the Index/Key of it as well. I can do it by using foreach and it will display the value of each element, but is there any single function in Vb.Net that took the Array of any kind and print the Elements of it with corresponding Key/Index value.
Thanks

Printing all elements in Array
Doug2005
Thanks for the Information...
that Loop function is what I am currently using.
Also can you suggest a way like in Recordset ad Session variable in ASP.NEt we can define a name to a index of an array can we do the same with our own Array
like in general if we do
s[0]="value"
s[1]="value2"
Now I want this
s['index1']="value"
s['index2']="value"
Is it possible
Thanks
halflife28
If you need the index, you can't use foreach. Instead, use a regular for-loop:
private void PrintArray(string[] s)
{
for (int i=0; i<s.Length; i++)
{
Console.WriteLine("{0} {1}", i, s[i]);
}
}
KevinGW