传递ByRef时VB检查Null Reference

Bra*_*ery 4 vb.net null pass-by-reference nothing

我有一个通过引用接受String的函数:

Function Foo(ByRef input As String)
Run Code Online (Sandbox Code Playgroud)

如果我这样称呼它:

Foo(Nothing)
Run Code Online (Sandbox Code Playgroud)

我想要它做一些不同的事情,如果我这样称呼它:

Dim myString As String = Nothing
Foo(myString)
Run Code Online (Sandbox Code Playgroud)

是否有可能在VB .NET中调用方法的方式中检测到这种差异?

编辑

为了澄清为什么我想要这样做,我有两种方法:

Function Foo()
  Foo(Nothing)
End Function

Function Foo(ByRef input As String)
  'wicked awesome logic here,  hopefully
End Function
Run Code Online (Sandbox Code Playgroud)

所有逻辑都在第二个重载中,但是如果Nothing传递给函数,我想执行不同的逻辑分支,而不是传入包含 的变量Nothing.

Ree*_*sey 6

否.在任何一种情况下,该方法"看到"对input指向任何内容的字符串()的引用.

从方法的角度来看,这些是相同的.