Click here to Skip to main content
15,883,883 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
What is the basic difference between String.Isnullorempty & String.Notnullorempty

eg:-

C#
public Boolean Validdata()
    {
        Boolean Valid = true;
        if (string.IsNullOrEmpty(txtDate.Text))
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Hello", "javascript:alert('Date Not Given')", true);
            Valid = false;
        }
        if (string.IsNullOrEmpty(txtStartTime.Text))
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Hello", "javascript:alert('StartTime Not Given')", true);
            Valid = false;
        }
 return true;
    }
Posted
Updated 18-Nov-11 0:30am
v2
Comments
Mehdi Gholam 18-Nov-11 6:31am    
EDIT -> fixed formatting
Prashant Srivastava LKO 18-Nov-11 6:35am    
Sir Please tell me How u edit this above code I don't know whenever I ask question somebody like you alter my text I don't know how they do it,What is the way to change this
sachin10d 18-Nov-11 6:43am    
in Add your solution here select the lines which you want to set as code
an
Add your solution here>>Code>>select the appropriate language
Sergey Alexandrovich Kryukov 18-Nov-11 13:32pm    
Where is thing non-existing method in your code? I'm just curious: who told you about it and how come you are asking not even looking at MSDN help page on System.String?!
--SA

1 solution

String.Isnullorempty = It's not null and it's not empty
String.NotnulloremptyI = It's not null or it is empty

the same question is answered there.

http://stackoverflow.com/questions/734372/string-isnullorempty-vs-string-notnullorempty[^]
 
Share this answer
 
Comments
rajeevcapgeminiindia 18-Nov-11 7:04am    
Is there such type functions exists in the .net String.Notnullorempty?
Actually i am not able to get it, Please clarify the same.
Sergey Alexandrovich Kryukov 18-Nov-11 13:31pm    
This is the main difference: Notnullorempty does not exist. How come anyone came up with that (and Pandya caught the bait)? :-) If it existed it would not be needed.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900