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
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#.
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;
}
What am I doing wrong here. I'm getting Bad array declator. Do I have to declare the size the array first?
Thanks
edit: I change the code as suggested. However, I'm getting this error.
"Cannot implicitly convert type 'object[]' to 'foo[]'. An explicit conversion exists (are you missing a cast?)"
I though I already set the type to foo in the ExcelStorage as typeof(foo). Nevermind, I did it with casting.