Check whether the string Empty string or Not-.NET
Consider in ASP.NET form u r having one Textbox.you want to check out the textbox entry is empty string or not......
1. if(TextBox1.Text.Trim()==string.Empty)
{
Response.write("The string is Empty string");
}
else
{
Response.write("The string is not Empty");
}
2. if (TextBox1.Text.Trim().Length> 0)
{
Response.write("The string is not Empty");
}
Comparing to the performance the second one 370% faster than the first one.
No comments:
Post a Comment