Dot-Net

如何在 VB.NET 中使用 IsNullOrEmpty?

  • October 30, 2012

為什麼以下內容不能在 VB.NET 中編譯?

Dim strTest As String
If (strTest.IsNullOrEmpty) Then
  MessageBox.Show("NULL OR EMPTY")
End if

IsNullOrEmpty 是“共享的”,所以你應該這樣使用它:

If String.IsNullOrEmpty(strTest) Then

引用自:https://stackoverflow.com/questions/13134534