Ejemplo n.º 1
0
        /// <summary>Creates a new csv file with the specified name and writes the whole table.</summary>
        /// <param name="rows">Table to write to the csv file.</param>
        /// <param name="fileName">File name of the csv file.</param>
        /// <param name="properties">Properties of the csv file.</param>
        /// <typeparam name="TStruct">Structure type.</typeparam>
        public static void WriteAlien <TStruct>(IEnumerable <TStruct> rows, string fileName, CsvProperties properties = default)
            where TStruct : struct
        {
            var layout = RowLayout.CreateAlien(typeof(TStruct), false);
            var writer = new CsvWriter(layout, fileName, properties);

            try
            {
                writer.Write(rows);
            }
            finally
            {
                writer.Close();
            }
        }