我正在尝试将此方法转换为 VB.NET,但在线转换器似乎将其转换为一团糟。有人可以帮忙吗:
C# 原文:
private IEnumerable<IGrouping<string, Reference>> FindReferencesWithTheSameShortNameButDiffererntFullNames(List<Reference> references)
{
return from reference in references
group reference by reference.ReferencedAssembly.Name
into referenceGroup
where referenceGroup.ToList().Select(reference => reference.ReferencedAssembly.FullName).Distinct().Count() > 1
select referenceGroup;
}
VB.NET 使用在线转换器:
Private Function FindReferencesWithTheSameShortNameButDiffererntFullNames(references As List(Of Reference)) As IEnumerable(Of IGrouping(Of String, Reference))
Return _
Where referenceGroup.ToList().[Select](Function(reference) reference.ReferencedAssembly.FullName).Distinct().Count() > 1
End Function
Where
未声明此错误。
我不会想到 VB 不会像这样的 C# 那样不同:
Private Function FindReferencesWithTheSameShortNameButDiffererntFullNames(references As List(Of Reference)) As IEnumerable(Of IGrouping(Of String, Reference))
Return From reference In references
Group reference By reference.ReferencedAssembly.Name
Into referenceGroup()
Where referenceGroup.ToList().Select(Function(reference) ReferencedAssembly.FullName).distinct().count() > 1
Select referenceGroup
End Function
但我得到:在这种情况下无法访问方法 referenceGroup 的定义......有人可以帮助我吗?