Iterate a Dictionary - best way


i using following way iterate dictionary

  foreach(keyvaluepair<string,string> entry in dict)    {            }  
there other ways iterate?

you can use linq - planning "entry" elements?

 

for example, if wanted values keys started "f", in one-liner using linq:

     var matches = dict.where(kvp => kvp.key.startswith("f")).select(kvp => kvp.value);


reed copsey, jr. - http://reedcopsey.com
if post answers question, please click "mark answer" on post , "mark helpful".


Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

BizTalk Server 2013 Azure VM Log Shipping and HA for hosts

How to Share webservice object to all user