Is Nothing Equivalent?

Discussion in 'ASP .Net' started by Adam J Knight, Jan 29, 2006.

  1. Hi all,

    Can anyone fill me in on the C# equivalent of this VB statement?

    If Not (Request.QueryString("myQString") Is Nothing) Then 'Do Something

    Cheers,
    Adam
     
    Adam J Knight, Jan 29, 2006
    #1
    1. Advertising

  2. Adam J Knight

    Guest

    How about:
    if (!Request.QueryString("myQString") == null)
    {
    DoSomething();
    }

    I'm pretty sure that's right. You don't really need the curly braces
    if you only have a single statement, but I always put them in, since
    it's easy to forget to add them when you add a second line to the if
    block and they're not already there.

    RobR
     
    , Jan 29, 2006
    #2
    1. Advertising

  3. This will also do it...

    if (!(Request.QueryString["myQString"] == null))
    {
    // Do something
    }



    Juan T. Llibre
    ASP.NET MVP
    ASPNETFAQ.COM : http://www.aspnetfaq.com
    ==================================
    <> wrote in message
    news:...
    > How about:
    > if (!Request.QueryString("myQString") == null)
    > {
    > DoSomething();
    > }
    >
    > I'm pretty sure that's right. You don't really need the curly braces
    > if you only have a single statement, but I always put them in, since
    > it's easy to forget to add them when you add a second line to the if
    > block and they're not already there.
    >
    > RobR
    >
     
    Juan T. Llibre, Jan 29, 2006
    #3
  4. "Adam J Knight" <> wrote in
    news::

    > Hi all,
    >
    > Can anyone fill me in on the C# equivalent of this VB statement?
    >
    > If Not (Request.QueryString("myQString") Is Nothing) Then 'Do
    > Something


    Adam,

    if (Request.QueryString("myQString") != null)
    // Do Something

    --
    Hope this helps.

    Chris.
    -------------
    C.R. Timmons Consulting, Inc.
    http://www.crtimmonsinc.com/
     
    Chris R. Timmons, Jan 29, 2006
    #4
  5. Adam J Knight

    Sonu Kapoor Guest

    Sonu Kapoor, Jan 29, 2006
    #5
  6. "carlosag" is easily the best on-line converter that I've seen.

    If you want to convert entire projects or would like additional features
    like conversion of VB or C# code within ASP.NET pages, then you'll need to
    check out the commercial converters (including us of course).

    --
    David Anton
    www.tangiblesoftwaresolutions.com
    Instant C#: VB to C# converter
    Instant VB: C# to VB converter
    Instant C++: C# to C++ converter & VB to C++ converter
    Instant J#: VB to J# converter



    "Sonu Kapoor" wrote:

    > http://www.carlosag.net/Tools/CodeTranslator/Default.aspx
    >
    > Sonu Kapoor [MVP]
    > ---
    > Posted via www.DotNetSlackers.com
    >
     
    =?Utf-8?B?RGF2aWQgQW50b24=?=, Jan 29, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Kamoski

    setting to Nothing

    Mark Kamoski, Aug 7, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    1,084
    Robert Jacobson
    Aug 7, 2003
  2. Claudio Biagioli
    Replies:
    2
    Views:
    4,568
    William F. Robertson, Jr.
    Jun 25, 2003
  3. Hector Bejarano

    Request.UrlReferrer is nothing

    Hector Bejarano, Jul 8, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    840
    Hector Bejarano
    Jul 8, 2003
  4. josh
    Replies:
    0
    Views:
    2,347
  5. Devin Jeanpierre
    Replies:
    2
    Views:
    470
    Devin Jeanpierre
    Feb 14, 2012
Loading...

Share This Page