In Visual Basic.net, If I have a List of T, where the Type is an object that always has a .Name property, how I can write a function that returns the .Name value?
Here is my code:
Public Function GetListOfListItemNames(Of T)(ListOfItems As List(Of T)) As List(Of String)
Dim ListToReturn As New List(Of String)
For x = 0 To ListOfItems.Count - 1
ListToReturn.Add(ListOfItems.Item(x).Name)
Next
Return ListToReturn
End Function
I am getting the following error:
Name' is not a member of 'T'