Hello

This is a bit of a big ask, but I have taken the leap to try and create an Application, which I have working in VB.NET 2005, to C# 2005, and to be honest I am struggling!!!

Can anyone suggest an equivalent way of writing the following method in C#

VB Code:
  1. Private Sub ConnectedGroup_DataChange(ByVal TransactionID As Integer, ByVal NumItems As Integer, ByRef ClientHandles As System.Array, ByRef ItemValues As System.Array, ByRef Qualities As System.Array, ByRef TimeStamps As System.Array) Handles ConnectedGroup.DataChange
  2.         ' We don't have error handling here since this is an event called from the OPC interface
  3.  
  4.         Try
  5.             Dim i As Short
  6.             For i = 1 To NumItems
  7.                 ' Use the 'Clienthandles' array returned by the server to pull out the
  8.                 ' index number of the control to update and load the value.
  9.                 If IsArray(ItemValues(i)) Then
  10.                     Dim ItsAnArray As Array
  11.                     Dim x As Integer
  12.                     Dim Suffix As String
  13.  
  14.                     ItsAnArray = ItemValues(i)
  15.  
  16.                     ' Store the size of array for use by sync write
  17.                     OPCItemIsArray(ClientHandles(i)) = ItsAnArray.GetUpperBound(0) + 1
  18.  
  19.                     OPCItemValue(ClientHandles(i)).Text = ""
  20.                     For x = ItsAnArray.GetLowerBound(0) To ItsAnArray.GetUpperBound(0)
  21.                         If x = ItsAnArray.GetUpperBound(0) Then
  22.                             Suffix = ""
  23.                         Else
  24.                             Suffix = ", "
  25.                         End If
  26.                         OPCItemValue(ClientHandles(i)).Text = _
  27.                          OPCItemValue(ClientHandles(i)).Text & ItsAnArray(x) & Suffix
  28.                     Next x
  29.                 Else
  30.                     OPCItemValue(ClientHandles(i)).Text = ItemValues(i)
  31.                 End If
  32.             Next i
  33.         Catch ex As Exception
  34.             ' Error handling
  35.             MessageBox.Show("OPC DataChange failed with exception: " + ex.Message, "SimpleOPCInterface Exception", MessageBoxButtons.OK)
  36.         End Try
  37.     End Sub

I have tried a number of different things, but cannot find an "equivalent" of the VB IsArray method. And also when I pass the Array into the method ByRef I do not seem to be able to access the members of that array in the way that I would expect i.e.

ItemValues[i] = something

I get the error:

Cannot apply indexing with [] to an expression of type 'System.Array'

Any ideas?!?!?

Thank you for your help!!

Gary