有人能详解下 get ... end get set ... end set 语句的详细调用过程及使用原理之类的吗?新手不是很理解这个函数,谢谢!MSDN
程序代码:
Public Class Form1
Dim firstName, lastName As String
Public Property fullName() As String
Get
If lastName = "" Then
Return firstName
Else
Return firstName & " " & lastName
End If
End Get
Set(ByVal Value As String)
Dim space As Integer = Value.IndexOf(" ")
If space < 0 Then
firstName = Value
lastName = ""
Else
firstName = Value.Substring(0, space)
lastName = Value.Substring(space + 1)
End If
End Set
End Property
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
fullName = "Firstname LastName"
MsgBox(fullName)
End Sub
End Class






