VcfReader Constructor

Initializes a new instance of the VcfReader class.

Definition

Namespace: FolkerKinzel.VCards
Assembly: FolkerKinzel.VCards (in FolkerKinzel.VCards.dll) Version: 8.0.1+a91cc3f0fd39aeb548e16006a60ca9dd10a304a2
C#
public VcfReader(
	TextReader reader
)

Parameters

reader  TextReader
The TextReader to use for parsing the VCF data.

Example

C#
using FolkerKinzel.VCards;

namespace Examples;

public static class VcfReaderExample
{
    // Reads a very large VCF file whose contents cannot be
    // completely held in memory.
    public static void Example(string filePath)
    {
        using var textReader = new StreamReader(filePath);
        using var reader = new VcfReader(textReader);

        IEnumerable<VCard> result = reader.ReadToEnd();

        Console.WriteLine("The file \"{0}\" contains {1} vCards.",
                          Path.GetFileName(filePath),
                          result.Count());
    }
}

/*
Console Output:

The file "LargeFile.vcf" contains 1000 vCards.
*/

Exceptions

ArgumentNullExceptionreader is null.

See Also