Example #1
0
        public static List <Fund> ReadFundList(string fileName)
        {
            List <Fund> woods = new List <Fund>();

            if (File.Exists(fileName))
            {
                using (XmlReader reader = XmlReader.Create(fileName))
                {
                    reader.MoveToContent();
                    while (reader.Read())
                    {
                        if (reader.IsStartElement() && !reader.Name.Equals("Fund"))
                        {
                            Fund fund = new Fund();
                            fund.ReadXml(reader);
                            woods.Add(fund);
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
            return(woods);
        }
Example #2
0
        public void ReadXml(XmlReader reader)
        {
            while (reader.Read())
            {
                if (reader.IsStartElement())
                {
                    switch (reader.Name)
                    {
                    case "Work":
                        work = new WorkOfArt();
                        work.ReadXml(reader);
                        break;

                    case "Fund":
                        fund = new Fund();
                        fund.ReadXml(reader);
                        break;

                    case "Location":
                        location = (Location)Enum.Parse(typeof(Location), reader.Value);
                        fund.ReadXml(reader);
                        break;

                    case "Price":
                        reader.Read();
                        price = Int32.Parse(reader.Value);
                        break;
                    }
                }

                if (reader.Name.Equals("Exhibit"))
                {
                    break;
                }
            }
        }