static void PersisUser()
{
List<JamesBondCar> myCars = new List<JamesBondCar>();
XmlSerializer xmlSer = new XmlSerializer(typeof(Person));
Person ps = new Person();
using (Stream fStream = new FileStream("Person.xml", FileMode.Create, FileAccess.Write, FileShare.None))
{
xmlSer.Serialize(fStream, ps);
}
SoapFormatter soapFormat = new SoapFormatter();
using (Stream fStream = new FileStream("Person.soap", FileMode.Create, FileAccess.Write, FileShare.None))
{
soapFormat.Serialize(fStream, ps);
}
BinaryFormatter binFormat = new BinaryFormatter();
UserPrefs userData = new UserPrefs();
userData.WindowColor = "Yelllow";
userData.FontSize = 50;
//Store object in a local file
using (Stream fStream = new FileStream("user.dat", FileMode.Create, FileAccess.Write, FileShare.None))
{
binFormat.Serialize(fStream, userData);
}
}