I have a string like string strn = \"abcdefghjiklmnopqrstuvwxyz\" and want a dictionary like:
string strn = \"abcdefghjiklmnopqrstuvwxyz\"
Dictionary(){ {\'a\',0}, {
Use the .Select operator first:
.Select
strn .Select((x, i) => new { Item = x, Index = i }) .ToDictionary(x => x.Item, x => x.Index);