ExtensionMethod.NET Home of 846 C#, Visual Basic, F# and Javascript extension methods

GetList(of TList)

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


<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
    Return ReturnList
End Function


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

Author: NetDorkie

Submitted on: 16 jul 2009

Language: VB

Type: System.Collection.Generic.List

Views: 3747