jclay
New member
I am going through some code C# that I need to figure out how to convert to VB. I have used Tangible Softwares Instant VB and a couple of other translaters, but this chunk I am on isn't working correctly.
Here is the C# code:
This is what Intant VB is producing:
The error that is shoing is related to the first parameter "t" in the first Function of the SELECT. It is stating:
" 't' is already declared as a type parameter of this method "
I know I know I need to learn LINQ and Lambda's, but am running up against a deparate need on this one.
Any help would be GREATLY appreciated.
Thanks,
Jim
Here is the C# code:
VB.NET:
public static T[][] SplitInChunks<T>(T[] arr, int chunkSize)
{
return arr.Select((t, idx) => new { t, idx })
.GroupBy(o => (o.idx / chunkSize), o => o.t)
.Select(g => g.ToArray()).ToArray();
}
This is what Intant VB is producing:
VB.NET:
Public Shared Function SplitInChunks(Of T)(ByVal arr() As T, ByVal chunkSize As Integer) As T()()
Return arr.Select(Function(t, idx) New With {Key t, Key idx}).GroupBy(Function(o) (o.idx / chunkSize), Function(o) o.t).Select(Function(g) g.ToArray()).ToArray()
End Function
The error that is shoing is related to the first parameter "t" in the first Function of the SELECT. It is stating:
" 't' is already declared as a type parameter of this method "
I know I know I need to learn LINQ and Lambda's, but am running up against a deparate need on this one.
Any help would be GREATLY appreciated.
Thanks,
Jim