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

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'