I do serialization by example
using System.Runtime.Serialization.Formatters.Binary; using System.IO; [Serializable] public class UserPrefs { public string WindowColor; public int FontSize; } static class Program { [STAThread] static void Main() { UserPrefs userData = new UserPrefs(); userData.WindowColor = "Yellow"; userData.FontSize = 50; BinaryFormatter binFormat = new BinaryFormatter(); // Сохранить объект в локальном файле. using (Stream fStream = new FileStream("user.xml", FileMode.Create, FileAccess.Write, FileShare.None)) { binFormat.Serialize(fStream, userData); } } } The file is created but as the xml file it does not open it writes it cannot display the XML page. Tell me what the error is.
<?xml version="1.0" encoding="UTF-8"?>? attach the xml to the question - Senior Pomidor