0

我正在尝试将“Nothing”传递给 Vb.NET 中的参数(使用 VS 2010,一切都默认)

代码是这样的:

Public Property status As statusEvidenta
  <DebuggerNonUserCode()> _
  Get
    Me.m_status = Nothing
    Me.m_status = MyForms.Create__Instance__(Of statusEvidenta)(Nothing) 

在哪里 :

Public m_status As statusEvidenta

和 :

Private Shared Function Create__Instance__(Of T As {System.Windows.Forms.Form, New})(ByRef Instance As T) As T
  Dim v_genericMethodVar As T
  If ((Not Instance Is Nothing) AndAlso Not Instance.IsDisposed) Then
    Return Instance
  End If

我不熟悉 VB.NET 但为什么我不能只传递一个 Nothing 参数?在 c++ 中你可以传递一个 NULL ,这在这里不可能吗?

我收到以下错误:

附加信息:对象引用未设置为对象的实例。

4

0 回答 0