[XML] SERIALISER UN DICTIONARY GÉNÉRIQUE

MasterShadows Messages postés 268 Date d'inscription lundi 1 mars 2004 Statut Membre Dernière intervention 19 avril 2012 - 24 déc. 2010 à 20:41
MasterShadows Messages postés 268 Date d'inscription lundi 1 mars 2004 Statut Membre Dernière intervention 19 avril 2012 - 24 déc. 2010 à 20:41
Cette discussion concerne un article du site. Pour la consulter dans son contexte d'origine, cliquez sur le lien ci-dessous.

https://codes-sources.commentcamarche.net/source/52641-xml-serialiser-un-dictionary-generique

MasterShadows Messages postés 268 Date d'inscription lundi 1 mars 2004 Statut Membre Dernière intervention 19 avril 2012 12
24 déc. 2010 à 20:41
Salut, technique interessante, mais n'aurait-il pas été plus judicieux de faire comme ceci :

public class SerializableDictionary<TKey, TValue> : Dictionary<TKey, TValue>, ISerializable
{
....
}

et d'implémenter le constructeur SerializableDictionary(SerializationInfo info, StreamingContext context) et la methode GetData(SerializationInfo info, StreamingContext context) ?
Rejoignez-nous