we can search dictionary like
var dictionary = new Dictionary<string,string>();
dictionary.Keys.Where( key => key.Contains("a")).ToList();
but it return list. i want that linq should return true or false. so what would be the right code that search dictionary with linq. please guide.
Use Any
instead of Where
:
dictionary.Keys.Any( key => key.Contains("a"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With