the best practice to check a string is null or not
is to use:
if(string.IsNullOrEmpty(StringVariable))
{
}
you cant not return a string variable with null value
from a property that returns a string data type
so you can do like this :
get
{
if(!string.IsNullOrEmpty(StringVariable
return StringVariable;
return string.Empty;
}
if you want to check an object if is null or not try:
if(obj!=null)
or
if(obj==null)