См. Приведенный ниже код. В Namespaces представляют собой DLL сегментирования, а не имен в одной и той же DLLРасширение общих ограничений
Public Interface ICoreTableCollection
End Interface
Public Interface ICoreTableInstance
End Interface
Namespace Address.Tier1
Public MustInherit Class AddressCollection(Of T As AddressInstance)
Implements ICoreTableCollection
End Class
Public MustInherit Class AddressInstance
End Class
End Namespace
Namespace PartnerAddress.Tier1
Public MustInherit Class PartnerAddressCollection(Of T As PartnerAddressInstance)
Implements ICoreTableCollection
End Class
Public MustInherit Class PartnerAddressInstance
MustOverride Function Parent(Of T As {ICoreTableCollection, New}, S As {ICoreTableInstance, New})() As S
End Class
End Namespace
Namespace Address.Tier2
Public Class AddressCollection(Of T As AddressInstance)
Inherits Address.Tier1.AddressCollection(Of T)
End Class
Public Class AddressInstance
Inherits Address.Tier1.AddressInstance
End Class
End Namespace
Namespace PartnerAddress.Tier2
Public Class PartnerAddressCollection(Of T As PartnerAddressInstance)
Inherits Tier1.PartnerAddressCollection(Of T)
End Class
Public Class PartnerAddressInstance
Inherits Tier1.PartnerAddressInstance
Public Overrides Function Parent(Of T As {New, ICoreTableCollection}, S As {New, ICoreTableInstance})() As S
End Function
'*****************
'This is what I want, but it's not allowed
'*****************
'Public Overrides Function Parent(Of T As {New, Address.Tier2.AddressCollection(Of S)}, S As {New, Address.Tier2.AddressInstance})() As S
'End Function
End Class
End Namespace
Есть в любом случае, чтобы расширить функциональные Родитель ограничения в Tier2.PartnerAddress, чтобы сделать его выглядеть следующим образом.
'*****************
'This is what I want, but it's not allowed
'*****************
Public Overrides Function Parent(Of T As {New, Address.Tier2.AddressCollection(Of S)}, S As {New, Address.Tier2.AddressInstance})() As S
End Function
вместо
Public Overrides Function Parent(Of T As {New, ICoreTableCollection}, S As {New, ICoreTableInstance})() As S
End Function
Я не уверен, как это относится к моему образцу кода. – Ted