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, 05:42 PM
Registered User
 
Join Date: Nov 2008
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
Default Code Question p179

Hi,

Can anyone give me breakdown of the following code on page 179 please?

if (!string.IsNullOrEmpty (value))

I'm a bit rusty and am puzzled, particularly by the use of the NOT operator. Could you provide a 'plain English' or pseudo code explanation please? Does it check that the string Is Not Null or Not Empty by using the ! operator?
 
Old January 1st, 2009, 05:55 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 Bill,

Basically it says:

If the variable value is not empty and if the variable value is not an empty string

string.IsNullOrEmpty is a boolean method that returns true when the value you pass in is either null (Nothing in VB.NET) or an empty string ("" / String.Empty).

By reversing its outcome using the ! operator, the code that follows will only be executed when the value variable contains a value that is not empty, and not null; e.g. some string value.

So, it checks that the string is NOT null and NOT empty

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!
The Following User Says Thank You to Imar For This Useful Post:
bill.mccullen (January 1st, 2009)
 
Old January 1st, 2009, 06:56 PM
Registered User
 
Join Date: Nov 2008
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
Default Code Question p179

Many Thanks Imar.
 
Old January 2nd, 2009, 05:06 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
Question on hastable code petfrog BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 2 February 22nd, 2008 05:15 PM
Default code question Fikus C# 2005 3 November 27th, 2006 05:57 PM
Adding code question zoidberg BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 1 October 5th, 2006 02:25 PM
Question on reusing code billb VBScript 0 August 18th, 2006 10:39 AM





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