Example #1
0
        /// <summary>
        /// Reads the whole file to a new list.
        /// </summary>
        /// <typeparam name="TStruct">Structure type.</typeparam>
        /// <returns>A new <see cref="List{TStruct}"/>.</returns>
        public IList <TStruct> ReadList <TStruct>()
            where TStruct : struct
        {
            var layout = RowLayout.CreateTyped(typeof(TStruct));

            RowLayout.CheckLayout(Layout, layout);
            if (!Layout.IsTyped)
            {
                Layout = layout;
            }

            var result = new List <TStruct>();

            while (reader.BaseStream.Position < reader.BaseStream.Length)
            {
                var row = ReadCurrentRow(reader, Version, layout);
                if (row != null)
                {
                    result.Add(row.GetStruct <TStruct>(layout));
                }
            }

            return(result);
        }
 /// <summary>Not supported.</summary>
 /// <param name="layout">Unused parameter.</param>
 public override void UseLayout(RowLayout layout) => RowLayout.CheckLayout(Layout, layout);