Пример #1
0
 public static void serialize(myApps myapps, string sXMLfile)
 {
     XmlSerializer xs = new XmlSerializer(typeof(myApps));
     //omit xmlns:xsi from xml output
     //Create our own namespaces for the output
     XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
     //Add an empty namespace and empty value
     ns.Add("", "");
     //StreamWriter sw = new StreamWriter("./SystemHealth.out.xml");
     StreamWriter sw = new StreamWriter(sXMLfile);
     xs.Serialize(sw, myapps, ns);
 }
Пример #2
0
        private void readFile(String filename)
        {
            try
            {
                myApps mApps = new myApps();
                mApps = mApps.ReadFile(filename);

                foreach (myApps.myApp app in mApps._myApps)
                    myAppList.Add(app);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Exception in deserialize: " + ex.Message);
            }
        }