471,354 Members | 1,187 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 software developers and data experts.

Print an array to the debug windows

In VB6 I have a routine that accepts a 2D array and prints it to the debug
windows. The array can be of any type (eg integer, string, double etc)....

Public Sub DPArray(ArrayToPrint As Variant)
Dim zz As Integer, xx As Integer
For zz = 1 To UBound(ArrayToPrint, 1)
For xx = 1 To UBound(ArrayToPrint, 2)
Debug.Print ArrayToPrint(zz, xx);
Next xx
Next zz
End Sub

How can I translate this to Csharp? I have tried the following but get an
"Cannot apply indexing with [] to an expression of type 'System.Array'"

public static void DPArray(Array ArrayToPrint)
for (int zz = 0; zz < ArrayToPrint.GetUpperBound(0); zz++)
for (int xx = 0; xx < ArrayToPrint.GetUpperBound(1); xx++)
Debug.WriteLine(ArrayToPrint[zz, xx]);

Dec 20 '05 #1
0 1204

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Graham Nicholls | last post: by
2 posts views Thread by abd el moniem | last post: by
3 posts views Thread by Gunawan | last post: by
10 posts views Thread by Altman | last post: by
6 posts views Thread by swartzbill2000 | last post: by
40 posts views Thread by Summercool | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.