public void Deserialize(ISerializable serializer, string path) { SmartphoneList deserialized = serializer.Deserialize(path); this.Clear(); this.AddRange(deserialized); }
public void Serialize(string path, SmartphoneList spList) { FileStream streamW = new FileStream(@path, FileMode.Create); XmlSerializer serializer = new XmlSerializer(typeof(SmartphoneList)); serializer.Serialize(streamW, spList); streamW.Close(); }
public void Serialize(string path, SmartphoneList spList) { FileStream streamW = new FileStream(@path, FileMode.Create); BinaryFormatter serializer = new BinaryFormatter(); serializer.Serialize(streamW, spList); streamW.Close(); }
public void Serialize(string path, SmartphoneList spList) { using (StreamWriter streamW = new StreamWriter(@path)) using (CsvWriter serializer = new CsvWriter(streamW)) { serializer.WriteRecords(spList); } }
public SmartphoneList Deserialize(string path) { FileStream streamR = new FileStream(@path, FileMode.Open); BinaryFormatter serializer = new BinaryFormatter(); SmartphoneList deserialized = (SmartphoneList)serializer.Deserialize(streamR); streamR.Close(); return(deserialized); }
public SmartphoneList Deserialize(string path) { FileStream streamR = new FileStream(@path, FileMode.Open); XmlSerializer serializer = new XmlSerializer(typeof(SmartphoneList)); SmartphoneList deserialized = (SmartphoneList)serializer.Deserialize(streamR); streamR.Close(); return(deserialized); }
public void Serialize(string path, SmartphoneList spList) { JsonSerializer serializer = new JsonSerializer(); using (StreamWriter streamW = new StreamWriter(@path)) using (JsonWriter writer = new JsonTextWriter(streamW)) { writer.Formatting = Formatting.Indented; serializer.Serialize(writer, spList); } }
public SmartphoneList GetByManufacturer(string manufacturer) { SmartphoneList spList = new SmartphoneList(); foreach (Smartphone listSp in this) { if (listSp.Manufacturer.Equals(manufacturer)) { spList.Add(listSp); } } return(spList); }
public SmartphoneList Deserialize(string path) { SmartphoneList deserialized = new SmartphoneList(); using (StreamReader streamR = new StreamReader(@path)) using (CsvReader serializer = new CsvReader(streamR)) { foreach (Smartphone listSp in serializer.GetRecords <Smartphone>()) { deserialized.Add(listSp); } return(deserialized); } }