Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class PrivateFieldNullTest
- Public Sub NullTestClass()
- _testClass = Nothing
- End Sub
- Private _testClass As TestClass
- Public Property GetTestClass() As TestClass
- Get
- If _testClass Is Nothing Then
- _testClass = New TestClass()
- _testClass.TestString = GetRandomString(5)
- End If
- Return _testClass
- End Get
- Set(value As TestClass)
- _testClass = value
- End Set
- End Property
- End Class
- Public Class TestClass
- Public Property TestString() As String
- End Class
- Private Sub NullTest()
- Dim toc As New PrivateFieldNullTest()
- Dim tc = toc.GetTestClass
- CheckIsSame.Text &= String.Format("NullTest - Before nullify '{0}';", tc.TestString)
- toc.NullTestClass()
- CheckIsSame.Text &= String.Format(" After nullify '{0}';", tc.TestString)
- CheckIsSame.Text &= String.Format(" new test string after Nullify '{0}';", toc.GetTestClass.TestString)
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement