private string strName = string.Empty; public string StrName
{
get
{
return strName;
}
set
{
strName = value;
this.textBox1.Text = strName;
}
}
{
get
{
return strName;
}
set
{
strName = value;
this.textBox1.Text = strName;
}
}
Private strName As String = String.Empty
Public Property StrName() As String
Get
Return strName
End Get
Set (ByVal Value As String)
strName = value
Me.textBox1.Text = strName
End Set
End Property
{
get
{
return strName;
}
set
{
strName = value;
this.textBox1.Text = strName;
}
} private ReadOnly strName As String = String.Empty
Public Property StrName() As String
Get
Return strName
End Get
Set(ByVal value As String)
strName = value
Me.textBox1.Text = strName
End Set
End Property
'StrName' 已經在此 class 中宣告為 'Private ReadOnly Dim strName As String'了。
變數 'StrName' 已在指派值之前使用。可能會在執行階段產生 null 參考例外狀況。
'ReadOnly' 變數不可以是指派的目標。