Here\'s a simplified version of what I\'m trying to do:
var days = new Dictionary();
days.Add(1, \"Monday\");
days.Add(2, \"Tuesday\");
..
You can do this instead :
var days = new Dictionary(); // replace int by int?
days.Add(1, "Monday");
days.Add(2, "Tuesday");
...
days.Add(7, "Sunday");
var sampleText = "My favorite day of the week is 'xyz'";
var day = days.FirstOrDefault(x => sampleText.Contains(x.Value));
and then :
if (day.Key == null) {
System.Diagnotics.Debug.Write("Couldn't find day of week");
}