Generic Types Question

Tech-Archive recommends: Fix windows errors by optimizing your registry



I have this structure:

Class ElemBase

Class Elem1 : Inherits ElemBase

Class ColecBase(Of GenElem As {ElemBase, New}) : Inherits
System.ComponentModel.BindingList(Of GenElem)

Class Colec1 : Inherits ColecBase(Of Elem1)

Class Class1

Public E As ElemBase

Public C As ColecBase(Of ElemBase)

End Class

Class Class2

Dim ColH As Colec1

Dim Cl1 As Class1

Sub proc()

Cl1.C = ColH

End Sub

End Class

I get an error in sub proc because Colect1 can't be converted to
ColecBase(of ElemBase)

there is a way to do this?


.



Relevant Pages

  • Re: Generic Types Question
    ... Class Elem1: Inherits ElemBase ... Class ColecBase(Of GenElem As ): Inherits ... Class Colec1: Inherits ColecBase(Of Elem1) ...
    (microsoft.public.dotnet.languages.vb)
  • Generic Types Question
    ... Class Elem1: Inherits ElemBase ... Class ColecBase(Of GenElem As ): Inherits ... Class Colec1: Inherits ColecBase ...
    (microsoft.public.dotnet.general)
  • Re: Generic Types Question
    ... Class Elem1: Inherits ElemBase ... : Inherits ... Class Colec1: Inherits ColecBase(Of Elem1) ...
    (microsoft.public.dotnet.languages.vb)