Exemplo n.º 1
0
        public static T[,] ReadMatrixFromCsv <T>(FileEntry source, TwoDimensionalArray transform = TwoDimensionalArray.None)
        {
            Contract.Requires(source != null);

            using (var stream = source.OpenText())
            {
                var reader = new CsvReader(stream, DefaultConfiguration);

                return(reader.DecodeMatrix <T>(transform, true));
            }
        }
Exemplo n.º 2
0
        public static IEnumerable <T[]> ReadMatrixFromCsvAsEnumerable <T>(FileInfo source)
        {
            Contract.Requires(source != null);

            // not tested!
            List <T[]> matrix;

            using (var stream = new StreamReader(source.FullName))
            {
                var reader = new CsvReader(stream, DefaultConfiguration);

                matrix = reader.DecodeMatrix <T>(true, out var rowCount, out var columnCount);
            }

            return(matrix);
        }