Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB 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 May 19th, 2011, 11:40 AM
Registered User
 
Join Date: Apr 2011
Posts: 26
Thanks: 0
Thanked 1 Time in 1 Post
Default Ch19 Try It Out p(704)

i'd noticed you used in step 9:

Code:
 if (AppConfiguration.SendMailOnError)
{
     .................email to be sent with errors.... etc
}
why not use:

Code:
 if (AppConfiguration.SendMailOnError == true)
instead ?! thanks
 
Old May 19th, 2011, 02:32 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

It comes down to the same thing. I find the first example easier to read, and with less noise. From a run-time persepctive, it's also the same. If SendMailOnError is true, you end up with this:

Code:
 
if (true)
{}
In the other example, you end up with:

Code:
 
if (true == true)
{}

which results in:

Code:
 
if (true)
{}

So, it's the same thing after all. Use whatever you find the easiest to read. I recall from my first ventures in .NET that I find your second example easier to read as well. Once you get used to the first form, you may find that easier.

Cheers,

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
Another Ch19 Issue Mjit BOOK: Beginning JavaServer Pages 1 November 8th, 2005 08:27 AM
CH19 Exception on example kula BOOK: Beginning JavaServer Pages 1 May 21st, 2005 02:33 AM
CH19 Strus Exception from example kula JSP Basics 0 May 2nd, 2005 02:23 PM





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