473,386 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Is Nothing Equivalent?

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
Jan 29 '06 #1
5 1024
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 '06 #2
This will also do it...

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

Juan T. Llibre
ASP.NET MVP
ASPNETFAQ.COM : http://www.aspnetfaq.com
==================================
<Ce**********@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
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 '06 #3
"Adam J Knight" <ad**********@optusnet.com.au> wrote in
news:ui**************@TK2MSFTNGP11.phx.gbl:
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/
Jan 29 '06 #4
"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/CodeTr...r/Default.aspx

Sonu Kapoor [MVP]
---
Posted via www.DotNetSlackers.com

Jan 29 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Tyler | last post by:
I am attempting to extend a legacy VB6 application by making it use a .NET component written in C# exposed through COM interop. Everything appeared to be going well (VB application creates the...
7
by: JohnZing | last post by:
hi if i have IsAdmin=True or IsAdmin=False why (IsAdmin = Nothing) is True??? i have function test(byval IsAdmin as boolean) If Not (IsAdmin = Nothing) Then End if
13
by: John A Grandy | last post by:
apparently references of type Date can not assume the value Nothing, because the following code fails: Dim d As Date .......other code...... If d Is Nothing Then End If so then what is...
11
by: Cal | last post by:
Help for a method says it may return null. An example in a book using that method checked the return against Nothing. Is Nothing the VB equivalent of null? Thanks Cal
31
by: Xero | last post by:
I have an array in my program. (Declared as letters(16, 16)). When I paused the program in debugging mode, I saw the following in the Autos window: letters |- (0, 0) | Nothing |- (0, 1) ...
6
by: Agnes | last post by:
I need to detect an object first. If it is not nothing... clear the dataset. However, Does there is any "is not nothing" function ?? Thanks If Me.pObjdaResultSet Is Nothing Then Else...
8
by: wjdennis | last post by:
I'm looking at a table with two date/time columns in it. One colulmn has its Default Value set to Null, the other has nothing in the Default Value entry. What is the difference between these two...
7
by: Eric Stott | last post by:
I have the following code in VB that needs to be done in C# Dim o As New Company.Common.QueueItem o.OrderID = 123456789 o.QueueItemType = Company.Common.QueueItemType.StockOrder Dim...
16
by: shapper | last post by:
Hello, I have a generic list as follows: Dim rows As New Generic.List(Of row) Now I have a row: Dim myRow As row I tried to check, further in my code, if the row is nothing: If myRow Is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.