Click or drag to resize

CsvReader Class

Reads CSV from a TextReader and provides the data by a row iterator.
Inheritance Hierarchy
SystemObject
  PDTec.IceNet.Sdk.UtilsCsvReader

Namespace:  PDTec.IceNet.Sdk.Utils
Assembly:  PDTec.IceNet.Sdk (in PDTec.IceNet.Sdk.dll) Version: 7.2.0.0 (7.2.7583.15464)
Syntax
C#
public class CsvReader : IDisposable

The CsvReader type exposes the following members.

Constructors
  NameDescription
Public methodCsvReader(TextReader)
Initializes a new instance of the CsvReader class
Public methodCsvReader(TextReader, Char, Char)
Initializes a new instance of the CsvReader class
Top
Properties
Methods
  NameDescription
Public methodDispose
Releases all resources used by the CsvReader
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetEnumerator
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodStatic memberSplit(String)
Public methodStatic memberSplit(String, Char, Char)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Remarks

Full-featured implementation (covers line-breaks in quoted cells). Specification see also: http://en.wikipedia.org/wiki/Comma-separated_values

Separator and delimiter characters are not fixed in CSV specification. The default characters are comma and apostrophe. In German enviromnents they can be switched to semicolon and (double) quote.

Examples
using (CsvReader reader = new CsvReader(new StringReader(csv), ';', '"'))
{
    foreach (List<string> row in reader)
    {
        foreach (string s in row)
        {
            Console.Write("[" + s + "]");
        }

        Console.WriteLine();
    }
}
See Also