title: C#: Object to string array. [*] to [] error (Knowing both VB.NET as well as C# helps)
body: <p>I have been assigned to Convert a VB.NET project to C# and I got stuck. I am using a class called RsiOPCAuto, but I don't think that I'll have to go into to much detail into explaining how it works. Let's just get on with my issue.</p>
  
  <p>So basicly what i do is grabbing an object from my class using this code:</p>
  
  <pre><code>public partial class FrmPartialMain : Form
  {
      RsiOPCAuto.OPCServer oOpcServer;
      public FrmPartialMain()
      {
          InitializeComponent();
          object RsiOPCAuto;
          object oOPCList;
  
          oOpcServer = new RsiOPCAuto.OPCServer();
          oOPCList = oOpcServer.GetOPCServers();
  </code></pre>
  
  <p>So far, so good. By adding a watch I can see that oOPCList now have the value {string[1..4]}.</p>
  
  <p>Now I want to put these four strings into a combo box. I do this with a simple for loop:</p>
  
  <pre><code>for (int i = 0; i &lt;= oOPCList.Length; i++)
  {
      cboServer.Items.Add(oOPCList[i]);
  }
  </code></pre>
  
  <p><em><strong>Edit: Scratch that, changed this to a much nicer foreach loop.</em></strong></p>
  
  <p>Even though this object now functions as a string array both the oOPCList.Length and (oOPCList[i]) get errors:</p>
  
  <p><strong>.Length:</strong>
  Error 1 'object' does not contain a definition for 'Length' and no extension method 'Length' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)</p>
  
  <p><strong>oOPCList[i]:</strong>
  Error 2 Cannot apply indexing with [] to an expression of type 'object'</p>
  
  <p>I bet it's the simplest thing but I just can't see it, help is very much appreciated and if there's anything else you need to know be sure to ask :-)</p>
  
  <p>PS. It might be worth mentioning that I have tried some different ways to convert the object to a string array but I continuously get an error telling me that I can not convert system.string[*] to system.string[].</p>
  
  <p>This is the VB.NET code that I am converting:</p>
  
  <pre><code>Friend Class frmPartialMain
      Inherits System.Windows.Forms.Form
          Dim oOpcServer As RsiOPCAuto.OPCServer
          Private Sub frmPartialMain_Load(ByVal eventSender As System.Object, ByVal eventArgs As  System.EventArgs) Handles MyBase.Load
              Dim RsiOPCAuto As Object
              Dim oOPCList() As Object
              Dim i As Integer
  
              oOpcServer = New RsiOPCAuto.OPCServer
              oOPCList = oOpcServer.GetOPCServers
              For i = LBound(oOPCList) To UBound(oOPCList)
                  cboServer.Items.Add(oOPCList(i))
              Next i
  </code></pre>