In the line 3 Im getting null exception. 'Discription' is a string were value sometimes is null. what check I can do before it goes to - (!Discription.ToLower().StartsWith("da") and throws error? Or how do I make null value acceptable?
private void FindBook(a, b)
{
if (discription == null && (!Discription.ToLower().StartsWith("da"))) //getting 'Can't be NULL' exception here.How do approach this issue? How do I fix this?
{
IsInLibrary = false;
}
else
{
IsInLibrary = true;
}
}
public string Discription
{
get
{
return _discription;
}
set
{
_discription = value;
if (value != null && (value.ToLower().StartsWith("da"))) //it is working here
{
IsInLibrary = true;
}
OnPropertyChanged("Discription");
}
}
if (!string.IsNullOrEmpty(discription))nullare not the same, the 1st is wrong, the 2nd is correct as you already found (where it says//it is working here). Just compare them character by character...discription,Discriptionand_discriptiondo you need all 3?