I have a bit of an awkward example but I am trying to extract a value from a dictionary if the key contains a substring. I have this part working, but I need to know when it does not find a match. The response from this request does not seem to accept a null. Here is the code that I am using to find a value from the dictionary.
var result = dictionaryOfItems.Where(x => x.Key.Contains(substring)).FirstOrDefault();This does what I want, but there will not always be a match. Sometimes result will be empty and I don't know how to verify this.
if(result != null) //doesnt work if(result != default(KeyValuePair<string, List<string>>) // does not work eitherHow do i check if a KeyValuePair object contains the default value that would be returned for a miss with the FirstOrDefault query?