Nov 27, 2015

Convert Dictionary to semicolon separated string in c#

"mykey1=myvalue1; mykey2=value2" 
string s = string.Join(";", myDict.Select(x => x.Key + "=" + x.Value).ToArray());
Dictionary<string, string> dict = m_FtpsExtendedProperties.Split(';')
      .Select(s => s.Split('='))
      .ToDictionary(key => key[0].Trim(), value => value[1].Trim()); 

0 comments:

Post a Comment

Nam Le © 2014 - Designed by Templateism.com, Distributed By Templatelib