how to write extension method to check string value is null or not.
Posted
by kumar
on Stack Overflow
See other posts from Stack Overflow
or by kumar
Published on 2010-04-09T18:26:41Z
Indexed on
2010/04/09
18:33 UTC
Read the original article
Hit count: 280
ASP.NET
|asp.net-mvc
Hi all,
(LocalVariable)ABC.string(Name)= (Idatareader)datareader.GetString(0);
this name value is coming from database.. what happening here is if this name value is null while reading it's throwing an exception?
I am manually doing some if condition here. I don't want to write a manual condition to check all my variables..
I am doing something like this now..
string abc = (Idatareader)datareader.GetValue(0);
if(abc = null)
//assiging null
else
assiging abc value
is there something like can we write extension method for this? thanks
© Stack Overflow or respective owner