警告 1 通過例項訪問共享成員、常量成員、列舉成員或巢狀型別;將不計算限定表示式。
阿新 • • 發佈:2018-12-09
Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Try Dim testClass1 As TestClass = New TestClass TestClass.testShare = 100 testClass1.testNoshare = 300 ' 共享成員在記憶體中只有一份,可以通過類名直接訪問 MsgBox("類中共享成員testChare的當前值為:" & TestClass.testShare) MsgBox("類中共享成員testChare的當前值為:" & testClass1.testNoshare) Catch ex As Exception MsgBox(ex) End Try End Sub End Class Class TestClass Public Shared testShare As Integer Public testNoshare As Integer End Class
警告 1 通過例項訪問共享成員、常量成員、列舉成員或巢狀型別;將不計算限定表示式。