469,270 Members | 1,106 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,270 developers. It's quick & easy.

isnull in C#

How do I checkif a string is empty in C# like isNull(string) in VB?
regards
reidarT
Nov 16 '05 #1
6 121090
"ReidarT" <re****@eivon.no> a écrit dans le message de news:
Oq**************@TK2MSFTNGP10.phx.gbl...
How do I checkif a string is empty in C# like isNull(string) in VB?
regards


if (string = null)

Joanna

--
Joanna Carter
Consultant Software Engineer
Nov 16 '05 #2
if (string = null) //Doesn't this assign null to string?
if (string == null) //This is what you want, to check if string is null

Chris

"Joanna Carter (TeamB)" <jo*****@nospamforme.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
"ReidarT" <re****@eivon.no> a écrit dans le message de news:
Oq**************@TK2MSFTNGP10.phx.gbl...
How do I checkif a string is empty in C# like isNull(string) in VB?
regards


if (string = null)

Joanna

--
Joanna Carter
Consultant Software Engineer

Nov 16 '05 #3
I get the message, null is not exist in the class or namespace

reidarT
"Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com> skrev
i melding news:%2****************@TK2MSFTNGP14.phx.gbl...
if (string = null) //Doesn't this assign null to string?
if (string == null) //This is what you want, to check if string is null

Chris

"Joanna Carter (TeamB)" <jo*****@nospamforme.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
"ReidarT" <re****@eivon.no> a écrit dans le message de news:
Oq**************@TK2MSFTNGP10.phx.gbl...
How do I checkif a string is empty in C# like isNull(string) in VB?
regards


if (string = null)

Joanna

--
Joanna Carter
Consultant Software Engineer


Nov 16 '05 #4
PP
I used the code as follows as it worked.
Note, c# is case-sensitive :-)
if (child == null)
{
strError = "Some Error";
return false;
}


"ReidarT" wrote:
I get the message, null is not exist in the class or namespace

reidarT
"Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com> skrev
i melding news:%2****************@TK2MSFTNGP14.phx.gbl...
if (string = null) //Doesn't this assign null to string?
if (string == null) //This is what you want, to check if string is null

Chris

"Joanna Carter (TeamB)" <jo*****@nospamforme.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
"ReidarT" <re****@eivon.no> a écrit dans le message de news:
Oq**************@TK2MSFTNGP10.phx.gbl...

How do I checkif a string is empty in C# like isNull(string) in VB?
regards

if (string = null)

Joanna

--
Joanna Carter
Consultant Software Engineer



Nov 16 '05 #5
"Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com> a
écrit dans le message de news: #y**************@TK2MSFTNGP14.phx.gbl...
if (string = null) //Doesn't this assign null to string?
if (string == null) //This is what you want, to check if string is null


Yup, still trying to juggle Delphi and C# :-)) Would you believe, I used to
do C++ until about 10 years ago?

Joanna

--
Joanna Carter
Consultant Software Engineer
Nov 16 '05 #6
> Yup, still trying to juggle Delphi and C# :-)) Would you believe, I used to
do C++ until about 10 years ago?


me too, we have similar backgrounds. I've got over a hundred legacy
Delphi programs and I'm slowly migrating to C#.

Eric
Nov 16 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Bob Cottis | last post: by
2 posts views Thread by Trev | last post: by
4 posts views Thread by Paul Spratley | last post: by
2 posts views Thread by Raoul Watson | last post: by
16 posts views Thread by madeleine | last post: by
4 posts views Thread by jimm.sander | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.