Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 1st, 2009, 03:22 PM
Friend of Wrox
 
Join Date: Dec 2008
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
 
Old January 1st, 2009, 05:51 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 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!
 
Old January 1st, 2009, 07:29 PM
Friend of Wrox
 
Join Date: Dec 2008
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
 
Old January 2nd, 2009, 05:02 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 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!





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





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