Accepted answer

assuming that delimiters cannot appear in keys or values:

var dict = str.split(';')
              .select(s => s.split(':'))
              .todictionary(a => a[0].trim(), a => a[1].trim()));

this is not the fastest way to do it, but it is the simplest.

you could also use a regex:

static readonly regex parser = new regex(@"([^:]):([^;])");

var dict = parser.getmatches(str)
                 .todictionary(m => m.groups[0].value.trim(), 
                               m => m.groups[0].value.trim()

Related Query

More Query from same tag