X hits on this document

PDF document

“Beginning Visual C# 2005 Express Edition Video Series” - page 23 / 73

188 views

0 shares

0 downloads

0 comments

23 / 73

Visual Basic:

Private m_elapsedMileage as integer

And then create a public property called ElapsedMileage:

Visual Basic:

Public Property ElapsedMileage() as integer Get () as integer return 5 End Get Set (ByVal Value as integer) ' Do nothing End Set End Property

First, did you notice how the IDE completed the structure of the Property statement for us? We can still modify it, but it is a nice convenience that the IDE gives us.

Second, notice that there are two distinct parts of the Property statement ... a Get and a Set. The Get retrieves and returns a value to the code that calls it. The Set assigns a Value. Note that the Property statement does nothing by itself; we have to decide which value to return when the Get statement is called and what to do with the Value that is passed into the parameter of the Set statement. We could ignore these values, "hard code" them, or whatever we like. Typically, we'll do this:

Supplemental Readings for the Express Edition Videos Copyright © 2005 LearnVisualStudio.NET



Document info
Document views188
Page views188
Page last viewedThu Dec 08 16:11:46 UTC 2016
Pages73
Paragraphs821
Words15988

Comments