예제 #1
0
        /// <summary>
        /// Creates a bookstore collection from a file
        /// </summary>
        /// <param name="filename">File containing bookstore data</param>
        /// <returns>BookstoreCollection</returns>
        public static BookstoreCollection FromFile(string filename)
        {
            BookstoreCollection _shoplist = new BookstoreCollection();
            if (File.Exists(filename))
            {
                using (ShopReader reader = ShopReader.Open(filename))
                {
                    while (reader.Read())
                    {
                        if (reader.HasInformation == true)
                            _shoplist.AddGoods(reader.Value);
                    }
                }
            }

            return _shoplist;
        }
예제 #2
0
        /// <summary>
        /// Creates a bookstore collection from a file
        /// </summary>
        /// <param name="filename">File containing bookstore data</param>
        /// <returns>BookstoreCollection</returns>
        public static BookstoreCollection FromFile(string filename)
        {
            BookstoreCollection _shoplist = new BookstoreCollection();

            if (File.Exists(filename))
            {
                using (ShopReader reader = ShopReader.Open(filename))
                {
                    while (reader.Read())
                    {
                        if (reader.HasInformation == true)
                        {
                            _shoplist.AddGoods(reader.Value);
                        }
                    }
                }
            }

            return(_shoplist);
        }