Monday, 6 November 2017
string.IsNullOrEmpty in C#.
in: asp csharp
In this article, We will discuss How to use string.IsNullOrEmpty efficiently.
Whenever people do coding at that time they check for null or empty Conditions to handle error like this,
string str="";
if(str == null or str == "" or str==string.Empty)
{
//your code if any
}
else
{
//your code if any
}
But without writing all those codes we can write it in a simple and clean way which is as follows,
string str="";
if(string.IsNullOrEmpty(str))
{
//your code if any
}
else
{
//your code if any
}
The string.IsNullOrEmpty can check null and empty condition Simultaneously and which is much faster as compared to Check multiple condition.
RELATED POSTS

Difference between string.IsNullOrEmpty and String.IsNullOrEmpty in C#.
In this article, We will discuss about what is the Difference between st ...

Difference Between string.Format and String.Format in C#.
In this article We will Discuss about What is the difference between stri ...

Difference Between maxRequestLength and maxAllowedContentLength.
maxRequestLength:- -------------------------------- 1/The maxRequestLengt ...

Install or UnInstall Windows Service With or Without using Visual Studio Command Prompt
Using Visual Studio Command Prompt:- Install:- Go to "Start" >> ...
-
This issue is Completely related to EntityFramework and this issue arises whenever you have installed EntityFramework in one project at th...
-
This is generally a Common Problem or the error could be like this, To Resolve this error, One Small Solution is Exists which is as b...
-
In this article, We will discuss What is the above Error and How to resolve this Error. Whenever, We are Restoring our database into A...
0 comments:
Post a Comment