Bonjour
Je voudrais comprendre la methode la plus simple pour sauver le contenu d'une classe dans un fichier afin de la recuperer ensuite
Bien sur en bon véréran du C, je pourrais ecrire cela "a la main" mais je pense quand meme que .NET offre des methodes 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 methode 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] [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
};[/CODE]
[QUOTE]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[/QUOTE]