
Chapter 3: Learning Just Enough C# and VB.NET: Types and Members | 85 |
Since the CurrentBalance property returns the value of the accountBalance field, the Console.WriteLine statement will print the value read from CurrentBalance to the command line.
Many of the properties you’ll write will simply be wrappers around current object state with no other logic, as in Listing
Listing 3-9 Property that wraps object state with no logic
C#:
private string m_firstName;
public string FirstName
{
get
{
return m_firstName;
}
set
{
m_firstName = value;
}
}
VB:
Private m_firstName As String
Public Property FirstName() As String Get
Return m_firstName End Get
Set(ByVal value As String) m_firstName = value
End Set End Property
In Listing