Bonjour
Je voudrais comprendre la methode la plus simple pour sauver le contenu d'une classe dans un fichier afin de la récupérer ensuite
Bien sur en bon vétéran du C, je pourrais écrire cela "a la main" mais je pense quand même que .NET offre des méthodes plus intégrée
J'ai donc essayé le code ci-dessous
Mais qui me donne une erreur
J'ai ensuite compris que je devais mettre la méthode GetObjectData dans ma classe
Mais je commence a me demander si je ne fais pas fausse route
Si quelqu'un sait comment faire simplement et peut me guider, je serais le plus heureux de ce jour !
Merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 [Serializable()] public class ImportDef : ISerializable // définition du template d'import { public string Country { get; set; } // country from import public UInt32 LayerID { get; set; } // layer Id from import public string LayerName { get; set; } // layer name from import public int isValid { get; set; } // set to 1 if definition is valid public bool useValue { get; set; } // false if value is not used (meta group Only) public int ColCode { get; set; } // indice colonne code public int ColValue { get; set; } // indice colonne valeur public int ColGroup { get; set; } // Optionnel indice colonne Groupe public bool optCount { get; set; } // true if value is count of lines public bool optNoDup { get; set; } // Avoid Duplicate public bool optGenVal { get; set; } // Automaticaly Generate Values from Input Key public int HeaderRow { get; set; } // indice row header (NoHeader = -1) public int FirstDataRow { get; set; } // indice first data row (default = -1) public string Separators {get;set;} // Separateurs public string FileName { get; set; } // full file name };Error 1 'Ogb.Import.ImportDef' does not implement interface member 'System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)' D:\projets\MapScope.v2\Mapscope\Import\import.cs
Partager