GetList(of TList)

<Extension()> _
Public Function GetList(Of TList As {IList(Of T), New}, T)(ByVal items As List(Of T)) As TList

    Dim ReturnList As New TList

    For Each item As T In items
        ReturnList.Add(item)
    Next
    Return ReturnList
End Function
Example:
Public Class AddressList
     Inherits System.Collection.Generic.List(of Address)
     ........
End Class

Public Class Address
     .........
End Class

Function GetAddressByType(Byval AddressType As String) As AddressList
Return AllAddresses.FindAll(Function(A As Address) A.App_Address_Type = AddressType).GetList(Of AddressList)()
End Function

Description

Return object of Subclass of List(Of T) using FindAll method of List.

Details

Double click on the code to select all.

 

;