Public Shared Function LoadAll(Of T)() As List(Of T)
Dim services As New List(Of T)()
For Each type As Type In Assembly.GetCallingAssembly().GetTypes()
If type.IsSubclassOf(GetType(T)) AndAlso Not type.IsAbstract AndAlso Not type.IsInterface Then
services.Add(DirectCast(Activator.CreateInstance(type), T))
End If
Next
Return services
End Function
No comments:
Post a Comment