我在尝试将以下C#的LINQ代码转换为VB.NET。这是C#代码,然后是我尝试转换成VB的代码。在VB中,我想将rowList声明为IEnumerable(Of IGrouping(Of Char, String))
,但它返回一个IEnumerable(Of IEnumerable(Of Char, String))
。
string rows = "ABC";
string cols = "123";
string[] squares = (from r in rows from c in cols select "" + r + c).ToArray();
IEnumerable<IGrouping<Char, String>> rowList = (from r in rows from s in squares where s.Contains(r) group s by r into g select g);
Dim rows As String = "ABC"
Dim cols As String = "123"
Dim squares As String() = (From r In rows From c In cols Select "" & r & c).ToArray()
Dim rowList = (From r In rows From s In squares Where s.StartsWith(r) Group By r Into g = Group Select g).Dump("rowList")