c# - How do I compare a string with key value in dictionary? -
how compare string key value in dictionary? suppose dictionary keys "f001.name", "f002.item", , "f003.content", , need find out keys have "foo1" in it.
i assume trying filter out list of values dictionary?
you can try below code, filter out pair key contains "f001":
dictionary<string, string> filtervalues = myvalues.where(s => s.key.contains("f001")).todictionary(s => s.key, s => s.value);
Comments
Post a Comment