J'ai le code suivant. Il utilise une classe créée pour gérer un type de fichier spécifique appelé plist. J'essaie de prendre ce qu'il me crache et de le mettre dans un dictionnaire.Comment convertir ce type dans un dictionnaire?
Dictionary<string, IPropertyListDictionary> maindict = new Dictionary<string, IPropertyListDictionary>();
maindict = data["section0"].DictionaryItems;
Le problème est que je reçois une ligne rouge sous « DictionaryItems » avec l'erreur suivante:
Cannot implicitly convert type
'System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,CodeTitans.Core.Generics.IPropertyListItem>>'
to
'System.Collections.Generic.Dictionary<string,CodeTitans.Core.Generics.IPropertyListDictionary>'.
An explicit conversion exists (are you missing a cast?)
Quelqu'un peut-il me aider jetai correctement ce? Merci.
http://stackoverflow.com/questions/2636603/recreating-a-dictionary-from-an-ienumerable –
+1 pour l'affichage du message d'erreur exact. – Marlon