Esempio n. 1
0
        /// <summary>
        /// Creates a record from the specified value.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="value">The value.</param>
        /// <param name="format">The format.</param>
        /// <returns></returns>
        public static CsvRecord From <T>(T value, CsvFormat format)
        {
            var headerValues = CsvUtility.GetHeader <T>();
            var values       = CsvUtility.GetValues(value);

            var header = new CsvHeader(headerValues, format);

            return(new CsvRecord(header, values, format));
        }
Esempio n. 2
0
        /// <summary>
        /// Updates the record at the specified index with the given value.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="index">The index.</param>
        /// <param name="value">The value.</param>
        public void UpdateWith <T>(int index, T value)
        {
            var values = CsvUtility.GetValues(value);

            Update(index, values);
        }
Esempio n. 3
0
        /// <summary>
        /// Writes the specified value.
        /// </summary>
        /// <typeparam name="T">Type of the value</typeparam>
        /// <param name="value">The value to write.</param>
        public void WriteWith <T>(T value)
        {
            List <string> values = CsvUtility.GetValues(value);

            WriteAll(values);
        }
Esempio n. 4
0
        /// <summary>
        /// Writes a record with the specified value at the given index.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="index">The index.</param>
        /// <param name="value">The value.</param>
        public void WriteAtWith <T>(int index, T value)
        {
            var values = CsvUtility.GetValues(value);

            WriteAt(index, values);
        }