Udostępnij za pośrednictwem


Example for my previous post

So here is an example how you can create a Nullable(Of Nullable ...)) type via indirection if Nullable were allowed to be passed to an As Structure type argument:

'in ClassLibrary1.dll you have this:
Public Class cls1(Of T As Structure)
   Function foo() As Nullable(Of T)
   End Function
End Class

'in Program1.exe you reference ClassLibrary1.cls and do this:

Module Module1
   Sub Main()
      Dim var1 As New cls1(Of Nullable(Of Integer)) '<=== nothing seems to be wrong here
'....... untill you do this call:
      var1.foo()      '<==== this would return Nullable(of Nullable(Of Integer)) !!!!!!!!
   End Sub
End Module