I am trying to convert Anthyme Caillard's INotifyDataErrorInfo implementation into VB.NET. All goes well until I reach the Validate method, which has the following LINQ query, in which q is of type IEnumerable<IGrouping<string, ValidationResult>>:
var q = from r in validationResults
from m in r.MemberNames
group r by m into g
select g;
I have tried the following translation:
Dim q = From r In valResults
From m In r.MemberNames
Group r By r.MemberNames Into Group
Select Group
Or even the lambda expression version, (assuming I'm using John Skeet's syntax correctly):
Dim q = valResults.GroupBy(Function(r) r, Function(r) r.MemberNames)
but in both of these, q is of type IEnumerable(Of IEnumerable(Of ValidationResult)).
I have looked at VB and IGrouping for LINQ Query and VB.Net - Linq Group By returns IEnumerable(Of Anonymous Type), but I don't think they apply since I will be working with the group directly, and not a specialized class.
Why aren't these implementations returning the same thing, and what can I do to make q the required IEnumerable(Of IGrouping(Of String, ValidationResult))?