Re: If( ) multiple conditions

From: Derek Harmon (loresayer_at_msn.com)
Date: 03/21/04


Date: Sun, 21 Mar 2004 13:29:28 -0500


"Andrew Banks" <banksy@nojunkblueyonder.co.uk> wrote in message news:TWk7c.22418$qi6.481283204@news-text.cableinet.net...
> How can I tst for multiple conditions in C#?
: :
> if(!Page.IsPostBack AND Request.QueryString["Refreshed"].ToString()=="1")

if ( !Page.IsPostBack && Request.QueryString[ "Refreshed"].ToString( ) == "1" )

'&&' does short-circuit (conditional) AND evaluation, which means if the page is posted
back it will not check the Request's query string.

If the second term had a side-effect, you might prefer '&' which is a logical AND that
checks both terms, even when the first term returns false.

Derek Harmon



Relevant Pages

  • Re: If( ) multiple conditions
    ... > How can I tst for multiple conditions in C#? ... '&&' does short-circuit AND evaluation, which means if the page is posted ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: If( ) multiple conditions
    ... miha at rthand com ... "Andrew Banks" wrote in message ... > How can I tst for multiple conditions in C#? ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: If( ) multiple conditions
    ... miha at rthand com ... "Andrew Banks" wrote in message ... > How can I tst for multiple conditions in C#? ...
    (microsoft.public.dotnet.languages.csharp)