IEnumerableExtensionSaveVcf Method

Saves a collection of VCard objects in a common VCF file.

Definition

Namespace: FolkerKinzel.VCards.Extensions
Assembly: FolkerKinzel.VCards (in FolkerKinzel.VCards.dll) Version: 8.0.1+a91cc3f0fd39aeb548e16006a60ca9dd10a304a2
C#
public static void SaveVcf(
	this IEnumerable<VCard?> vCards,
	string filePath,
	VCdVersion version = VCdVersion.V3_0,
	ITimeZoneIDConverter? tzConverter = null,
	VcfOpts options = VcfOpts.Default
)

Parameters

vCards  IEnumerableVCard
The VCard objects to be saved. The collection may be empty or may contain null values.
filePath  String
The file path. If the file exists, it will be truncated and overwritten.
version  VCdVersion  (Optional)
The vCard version of the VCF file to be written.
tzConverter  ITimeZoneIDConverter  (Optional)
An object that implements ITimeZoneIDConverter to convert IANA time zone names to UTC offsets, or null.
options  VcfOpts  (Optional)
Options for writing the VCF file. The flags can be combined.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerableVCard. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Remarks

  Caution

Although the method itself is thread-safe, the VCard objects passed to the method are not. Block read and write access to these VCard objects, while this method is being executed!

The method may serialize more vCards than the number of elements in the collection passed to the vCards parameter. This can happen if there are embedded VCard objects in the Members or Relations properties.

Exceptions

ArgumentNullExceptionfilePath or vCards is null.
ArgumentExceptionfilePath is not a valid file path.
ArgumentOutOfRangeExceptionversion is not a defined value of the VcfOpts enum.
IOExceptionThe file could not be written.

See Also