65.9K
CodeProject is changing. Read more.
Home

Check for empty string using length property of the string variable

starIconstarIconemptyStarIconemptyStarIconemptyStarIcon

2.00/5 (1 vote)

Jun 23, 2010

CPOL
viewsIcon

11232

Most of the developers use string.Empty to check the empty string. Instead we can check and compare the length property is zero to know the string value is empty or not. This will increases the performance :thumbsup: Example: string empName = txtEmployeeName.Text; if(empName.Length <= 0) Response.Write("Employee name is empty");