Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 6th, 2006, 10:58 AM
Authorized User
Join Date: Mar 2006
Location: , , .
Posts: 14
Thanks: 0
Thanked 1 Time in 1 Post
Default 'this.ID = id;' in class construction


I have a question on the 'ArticleDetails' Class on page 219.

Previously I have created class properties by doing the following:

- pass a parameter into the class constructor as follows:
public ArticleDetails(int ID)
- declare a private field within the class:
private int _id = 0;
- declare a public property withint the class:
public int ID
    get { return _id; }
    set { _id = value; }

However, on page 219, the parameter passed into the class is:
id, as in public ArticleDetails(int id)
rather than:
ID, as in public ArticleDetails(int ID)
And there is the additional statement:
this.ID = id;

What is the purpose of doing it this way? Is it just a difference of syntax which achieves exactly the same thing, or is there something else going on here?
Is 'this.ID' available due to the public property declaration later on in the code, i.e. 'public int ID'?

Basically, the way I have known to do this involves two variables,
_id and ID
The example on page 219 involves three variables:
_id, ID and id

Why is this?

Any thoughts on this would be much appreciated.

Thanks! :)



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
The class is configured to run as a security ID di marko2748au Pro VB Databases 2 January 20th, 2011 11:42 PM
Class to set student name & id curiaquita Visual C++ 2 February 3rd, 2009 01:54 PM
XSLT change class attribute by ID? matallen XSLT 8 March 1st, 2006 05:00 PM
ID crmpicco HTML Code Clinic 5 February 10th, 2005 11:50 AM
why not index.asp?id=1 can be www.myweb.com/?id=1 BurhanKhan Classic ASP Professional 11 September 6th, 2004 02:06 PM

All times are GMT -4. The time now is 08:58 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.