IEnumerableExtensionSerializeVcf Method

Serializes a collection of VCard objects into a Stream using the VCF format.

Definition

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

Parameters

vCards  IEnumerableVCard
The VCard objects to be serialized. The collection may be empty or may contain null values.
stream  Stream
A Stream into which the serialized VCard objects are written.
version  VCdVersion  (Optional)
The vCard version used for the serialization.
tzConverter  ITimeZoneIDConverter  (Optional)
An object that implements ITimeZoneIDConverter to convert IANA time zone names to UTC offsets, or null.
options  VcfOpts  (Optional)
Options for serializing VCF. The flags can be combined.
leaveStreamOpen  Boolean  (Optional)
true means that the method does not close the underlying Stream. The default value is false.

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

ArgumentNullExceptionstream or vCards is null.
ArgumentExceptionstream does not support write operations.
ArgumentOutOfRangeExceptionversion is not a defined value of the VcfOpts enum.
IOExceptionI/O error.
ObjectDisposedExceptionstream was already closed.

See Also