De string para dicionário

Crie uma função que receba um array de strings e retorne um dicionário/mapa. Cada string contém uma chave e um valor separados por =.

Exemplos

Program.StringToDictionary(new string[]{"1=one", "2=two", "3=three", "4=four"}) ➞ new Dictionary<string, string>{{"1", "one"}, {"2", "two"}, {"3", "three"}, {"4", "four"}}

Program.StringToDictionary(new string[]{"dog=bark", "cat=meow", "cow=moo"}) ➞ new Dictionary<string, string>{{"dog", "bark"}, {"cat", "meow"}, {"cow", "moo"}}

Program.StringToDictionary(new string[]{"bob=human", "lola=dog", "mittens=cat", "todd=frog"}) ➞ new Dictionary<string, string>{{"bob", "human"}, {"lola", "dog"}, {"mittens", "cat"}, {"todd", "frog"}}

Notas

  • O array de entrada pode ter diferentes tamanhos.
  • A chave é a parte que aparece antes do primeiro =, e o valor é tudo o que aparece depois, incluindo quaisquer caracteres = posteriores.