Dynamic array in C# (vb.net snippet)
<pre><code>Private Function getFoo(ByVal _FileInfo As FileInfo) As foo()
    Dim provider As New ExcelStorage(GetType(foo))
    provider.StartRow = 2
    provider.StartColumn = 1
    provider.FileName = _FileInfo.FullName
    Dim res() As foo = provider.ExtractRecords()
    Return res
End Function
</code></pre>

<p>I have the above code in vb.net that i'm trying to convert to C#. I'm using FileHelper library to extract data from Excel. This is my conversion to C#.</p>

<pre><code>public static foo GetFoo(FileInfo fInfo)
{
var provider = new ExcelStorage(typeof(foo));
provider.StartRow = 2;
provider.StartColumn = 1;
provider.FileName = fInfo.FullName;
foo res[] = provider.ExtractRecords();
return res;
}
</code></pre>

<p>What am I doing wrong here. I'm getting Bad array declator. Do I have to declare the size the array first?</p>

<p>Thanks</p>

<p>edit: I change the code as suggested. However, I'm getting this error.</p>

<p>"Cannot implicitly convert type 'object[]' to 'foo[]'. An explicit conversion exists (are you missing a cast?)"</p>

<p>I though I already set the type to foo in the ExcelStorage as typeof(foo).
Nevermind, I did it with casting.</p>
