how return true if dictionary contains key 1 else return false. how can change below line return boolean
var dicresult = dic.where(p => p.key == 1);
use any instead of where. returns true if condition matched
bool result = dic.any(p => p.key == 1); the same in vb.net
dim result = dic.any(function(p) p.key = 1) edit
in response comment below, use same pattern checking dates stored strings in value of dictionary
dim dic = new dictionary(of int32, string)() dic.add(1, "14/07/2015") dim result = dic.any(function(x) datetime.parse(x.value) > datetime.parse("11/07/2015")) console.writeline(result) (my locale dd/mm/yyyy)
Comments
Post a Comment