Caution
public static string AsString(
IEnumerable<VCard?> vCards,
VCdVersion version = VCdVersion.V3_0,
ITimeZoneIDConverter? tzConverter = null,
VcfOpts options = VcfOpts.Default
)
Public Shared Function AsString (
vCards As IEnumerable(Of VCard),
Optional version As VCdVersion = VCdVersion.V3_0,
Optional tzConverter As ITimeZoneIDConverter = Nothing,
Optional options As VcfOpts = VcfOpts.Default
) As String
public:
static String^ AsString(
IEnumerable<VCard^>^ vCards,
VCdVersion version = VCdVersion::V3_0,
ITimeZoneIDConverter^ tzConverter = nullptr,
VcfOpts options = VcfOpts::Default
)
static member AsString :
vCards : IEnumerable<VCard> *
?version : VCdVersion *
?tzConverter : ITimeZoneIDConverter *
?options : VcfOpts
(* Defaults:
let _version = defaultArg version VCdVersion.V3_0
let _tzConverter = defaultArg tzConverter null
let _options = defaultArg options VcfOpts.Default
*)
-> string
The method may serialize more vCards than were originally elements in the argument vCards. This happens when a VCF file is saved as vCard 4.0 and when in the properties Members or Relations of a VCard object further VCard objects can be found.
In the same way the method behaves, if a vCard 2.1 or 3.0 is serialized with the option AppendAgentAsSeparateVCard and if in the Relations property of a VCard object an instance is located on whose RelationType parameter the Agent flag is set.
using FolkerKinzel.VCards;
using FolkerKinzel.VCards.Enums;
namespace Examples;
public static class NoPidExample
{
public static void RemovePropertyIdentification()
{
const string vcf = """
BEGIN:VCARD
VERSION:4.0
REV:20231121T200704Z
UID:urn:uuid:5ad11c78-f4b1-4e70-b0ef-6f4c29cf97ea
FN;PID=1.1:John Doe
CLIENTPIDMAP:1;http://other.com/
END:VCARD
""";
VCard vCard = Vcf.Parse(vcf)[0];
// Removes all existing PIDs and CLIENTPIDMAPs
vCard.Sync.Reset();
Console.WriteLine(Vcf.AsString(vCard, VCdVersion.V4_0));
}
}
/*
Console Output:
BEGIN:VCARD
VERSION:4.0
REV:20231121T201552Z
UID:urn:uuid:5ad11c78-f4b1-4e70-b0ef-6f4c29cf97ea
FN:John Doe
END:VCARD
*/
ArgumentNullException | vCards is null. |
ArgumentOutOfRangeException | version is not a defined value of the VcfOpts enum. |
OutOfMemoryException | The system is out of memory. |