VcfReader Class

Allows iterating through the contents of large VCF files without having to keep all the parsed content in memory.

Definition

Namespace: FolkerKinzel.VCards
Assembly: FolkerKinzel.VCards (in FolkerKinzel.VCards.dll) Version: 8.0.1+a91cc3f0fd39aeb548e16006a60ca9dd10a304a2
C#
public sealed class VcfReader : IDisposable
Inheritance
Object    VcfReader
Implements
IDisposable

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.
*/

Constructors

VcfReader Initializes a new instance of the VcfReader class.

Methods

Dispose Releases all resources used by the current instance of the VcfReader class.
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
ReadToEnd Returns an IEnumerableT of VCard objects that can be used to iterate over the VCF contents.
ToStringReturns a string that represents the current object.
(Inherited from Object)

See Also