public IEnumerable<VCard> ReadToEnd()
Public Function ReadToEnd As IEnumerable(Of VCard)
public:
IEnumerable<VCard^>^ ReadToEnd()
member ReadToEnd : unit -> IEnumerable<VCard>
Unlike the methods of the Vcf class, the Dereference(IEnumerableVCard) method is not called on the return value. The AnsiFilter class cannot be used by VcfReader either.
If possible, use the Vcf class if it is justifiable to keep the parsed content completely in memory. The utility of the VcfReader class is to read huge files.
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.
*/
IOException | Could not read from the source. |