我们可以使用Nullable(of T)来使用List <of T>吗?

Mit*_*tul 1 vb.net generics

在下面的示例代码中,我尝试将Nullable(of T)用于DateTime,并且我想使用与Dimensions属性相同的List(Dimension).

 Private _duedate As Nullable(Of DateTime)
        Public Property DueDate() As Nullable(Of DateTime)
            Get
                Return _duedate
            End Get
            Set(ByVal value As Nullable(Of DateTime))
                _duedate = value
            End Set
        End Property

   Private _dimensions As List(Of Dimension)
            Public Property Dimensions() As List(Of Dimension)
                Get
                    Return _dimensions
                End Get
                Set(ByVal value As List(Of Dimension))
                    _dimensions = value
                End Set
            End Property
Run Code Online (Sandbox Code Playgroud)

如果我们可以请求任何帮助我们如何做到这一点将不胜感激.

谢谢.

Jar*_*Par 5

有没有必要使用Nullable(Of T)List(Of T).只需List(Of T)直接使用并使用Nothing无值状态.

基本功能Nullable(Of T)提供的是值类型具有无值状态.这个概念在C#中更清晰,其中没有值null和默认值之间存在语法差异default(T).在VB.Net中,虽然简单地Nothing表示没有引用类型的值和值类型的默认值.