我有以下情况(VB.NET,.NET 4):
自定义对象的通用列表letters(Of Letter)
A, B, C, B, D
需要一个包含项目及其索引的集合:
A (0)
B (1, 3)
C (2)
D (4)
有些尝试:
Dim letters As New List(Of Letter)
Dim query As ??? = letters.Select(Function(letter, index) _
New With {index, letter})
Dim lookup As Lookup(Of Letter, Integer)
lookup = letters (query).ToLookup(???