I have a Boolean function which checks the names from database, If any name exists in database which returns true. my function is
public bool rawMtrlExists(string strRawMtrl)
{
var rwMtrl = prodctsDC.productsnrwmtrls.Where(c => c.item_Ctgry == 'R' || c.item_Ctgry == 'B'||c.item_Ctgry=='G').Distinct().ToArray();
return rwMtrl.Count(d => d.item_Name == strRwMtrl) > 0;
}
My problem is.. If my strRawMtrl orgument having the same word but with casesensitive, the method returning false. I mean name in database field is Central Processing Unit. Iam passing as central processing unit. In this case It is returning false but I need true. Please anybody help me to return not for case sensitive words too.
You can use overloaded
Equalsmethod withStringComparison.OrdinalIgnoreCase:Another hacky way which I don’t prefer since it creates two more strings in heap: