Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-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
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 1st, 2009, 03:22 PM
Friend of Wrox
Points: 505, Level: 8
Points: 505, Level: 8 Points: 505, Level: 8 Points: 505, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2008
Location: , , .
Posts: 119
Thanks: 26
Thanked 0 Times in 0 Posts
Default pgs. 506-512 "r" ?

Hi Imar:

In the code on those pages, what is "r"? Is it a special character or is it a variable we create? (looking at the C# code on pages 507 & 512.

And if it is a variable, what isn't it a number rather than a letter since we're looking for a review.ID?

Rachel
Reply With Quote
  #2 (permalink)  
Old January 1st, 2009, 05:51 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi Rachel,

Take a look (back) at chapter 13 - LINQ, with page 433 in particular. It shows the following LINQ query:

var allReviews = from r in myDataContext.Reviews
select r;

Right below it, r is explained and referred to as a "range variable" which is available within the context of the query. It's used to refer to an item in the collection in the relevant parts of the query (in the select clause to select it, in the where clause to filter it and so on).
So, yes, it is indeed a variable name. You can make up anything you want as long it's a valid C# variable name. That rules out pure number though.

I typically use a single letter from the strongly typed items I am querying. So, I'd use a b for Books, an r for Reviews and so on. However, if you want you can be more expressive:

var allReviews = from review in myDataContext.Reviews
select review;

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #3 (permalink)  
Old January 1st, 2009, 07:29 PM
Friend of Wrox
Points: 505, Level: 8
Points: 505, Level: 8 Points: 505, Level: 8 Points: 505, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2008
Location: , , .
Posts: 119
Thanks: 26
Thanked 0 Times in 0 Posts
Default

I'm sorry. I even had it highlighted! I thought I had read something about that, but then I couldn't find it. I didn't go back far enough in the chapters. (I wish I had a copy of this in pdf format!)

Thanks for your patience,

Rachel
Reply With Quote
  #4 (permalink)  
Old January 2nd, 2009, 05:02 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

No problem, and you're welcome.....

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
Reply


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
preserving " for later use in testing in xslt akentanaka XSLT 1 October 14th, 2008 03:59 AM
Chapter 5 "Try It Out", pgs. 149-50 pfloyd BOOK: Beginning XML, 4th Ed ISBN: 978-0-470-11487-2 0 December 21st, 2007 05:15 PM
replacing " gantait XSLT 1 March 4th, 2007 10:44 AM
errata chapter 5 pgs 164 & 165 wentz1 BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 1 August 25th, 2005 04:00 AM
Replace Character " fosca XSLT 1 November 11th, 2004 04:14 PM



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


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