假设我有一个猫的列表。如何将列表(对象)快速转换为列表(“Object.field”)?
Public Class Cat
Public Property id As Guid
Public Property name As String
Public Property race As catRace
End Class
如何使用id属性将此List(Cat)快速转换为List(Guid)?
我可以这样做:
Dim newList As List(Of Guid)
For each item in catList
newList.Add(item.id)
Next
但我认为必须有一个办法做到这一点更快(1个LOC)。我无法找到如何。
航空代码。函数(t)t.id – MarkJ