Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3
This is the forum to discuss the Wrox book Beginning C# 3.0 : An Introduction to Object Oriented Programming by Jack Purdum; ISBN: 9780470261293
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3 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 February 15th, 2011, 07:11 PM
Authorized User
 
Join Date: Feb 2011
Posts: 21
Thanks: 2
Thanked 0 Times in 0 Posts
Default p114, confusion over text.

Good evening,

I was wondering if someone could clarify the following text for me.

"Now ask yourself this question: What kind of data type is the Text property? Well, if the Text
property is storing textual data, the data must be stored in a string data type. Because the Text property
of a textbox object is a string variable, it also means the Text property is a string object ."

i understand its storing data in the type string. its the section after, especially the section stating its a string variable and why that means its a string object that i dont understand.

sorry if this seems like a stupid question but im genuinely confused so i would appreciate it if someone could elaborate on the above or point me to an earlier section in the book where i seem to have missed what was being explained.

Thanks for your time

Rgds

Scolty
  #2 (permalink)  
Old February 16th, 2011, 01:21 AM
Friend of Wrox
Points: 1,166, Level: 13
Points: 1,166, Level: 13 Points: 1,166, Level: 13 Points: 1,166, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2008
Location: Indianapolis, IN, USA.
Posts: 234
Thanks: 0
Thanked 32 Times in 30 Posts
Default

Hi scolty:

You're probably right...not the most clear piece of writing. My point is that a property does not have to be a resolved data type, like an int, or float, or double. An object's property can hold another object. In this example, the textbox object holds a number of properties, of which the Text property is but one of many properties encased in the textbox object. However, the chain of information of the Text property does not end with:

textbox.Text

We already know that in C#, any text that appears in the program is actually a string object. As you saw on page 108, we can write:

int len;
string zip = "80122";
len = zip.Length;

Because a property of all strings is Length, and Text in a textbox object is a string object, we can determine the length of Text by reading the length of the text string:

len = txtInput.Text.Length;

Note that we have two dot operators here. All that means is that we are getting a property of an object that's within another object. Look back to Figure 2-6 and 2-7. In Figure 2-7, if we're inside a object looking at "Issy", we're looking at a string. While we're "inside" clsperson, we can take our wheelbarrow, press the dot operator for the "Issy" string and read the Length of that string.

Too many students choke when they see more than one dot operator. Just keep this in mind: Any time you see a dot operator, it's like going one level deeper towards the center of an onion. To peer deeper into an object requires "pressing" the dot operator to open the door and enter the next layer of the onion. When OOP was first starting, I can remember using a database object that had 13 (yes, thirteen!) dot operators to go through before you exhausted all layers on the primary object. (Poorly designed, in my opinion.)

It's pretty late, so this may not be the clearest explanation, but it's the best I can come up with right now. Read this post a few times while looking at Figure 2-7 and then go back and read page 108 and see if it makes more sense. If not, let me know.
__________________
Jack Purdum, Ph.D.
Author: Beginning C# 3.0: Introduction to Object Oriented Programming (and 14 other programming texts)
The Following User Says Thank You to DrPurdum For This Useful Post:
scolty (February 16th, 2011)
  #3 (permalink)  
Old February 16th, 2011, 08:49 AM
Authorized User
 
Join Date: Feb 2011
Posts: 21
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Good Afternoon,

Thanks again for your reply. Yeah i believe it makes sense now assuming the following is correct.

An object may have several properties. Each property will have a specific type associated with it, ie int, string etc BUT one or more of the objects properties may not have a fixed type because they hold objects.

If this is correct then i get it now

Thanks again for your help + your book is definately one of the best i have read on this subject. I have read a few before and had to put my aim of understanding C# on hold as i wasnt able to pick it up with their books.

Rgds

Scolty
  #4 (permalink)  
Old February 16th, 2011, 04:58 PM
Friend of Wrox
Points: 1,166, Level: 13
Points: 1,166, Level: 13 Points: 1,166, Level: 13 Points: 1,166, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2008
Location: Indianapolis, IN, USA.
Posts: 234
Thanks: 0
Thanked 32 Times in 30 Posts
Default

Yep, you got it...
__________________
Jack Purdum, Ph.D.
Author: Beginning C# 3.0: Introduction to Object Oriented Programming (and 14 other programming texts)
 


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
Class' Confusion dpkbahuguna Beginning VB 6 4 September 20th, 2006 11:16 PM
Some confusion in these code hpatel_it ASP.NET 1.0 and 1.1 Basics 0 August 30th, 2006 08:19 AM
.net Confusion reyboy General .NET 1 December 29th, 2004 08:35 AM
Some confusion as to which SQL to use mark.uk SQL Server 2000 6 August 12th, 2004 10:47 AM



All times are GMT -4. The time now is 04:52 AM.


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