/// <summary> /// Copy ctor /// </summary> /// <param name="vCard">The vCard to clone.</param> private VCard(VCard vCard) { Version = vCard.Version; Func <ICloneable?, object?> cloner = Cloned; foreach (KeyValuePair <VCdProp, object> kvp in vCard._propDic) { Set(kvp.Key, kvp.Value switch { XmlProperty xmlProp => xmlProp.Clone(), IEnumerable <XmlProperty?> xmlPropEnumerable => xmlPropEnumerable.Select(cloner).Cast <XmlProperty?>().ToArray(), ProfileProperty profProp => profProp.Clone(), TextProperty txtProp => txtProp.Clone(), IEnumerable <TextProperty?> txtPropEnumerable => txtPropEnumerable.Select(cloner).Cast <TextProperty?>().ToArray(), DateTimeProperty dtTimeProp => dtTimeProp.Clone(), IEnumerable <DateTimeProperty?> dtTimePropEnumerable => dtTimePropEnumerable.Select(cloner).Cast <DateTimeProperty?>().ToArray(), AddressProperty adrProp => adrProp.Clone(), IEnumerable <AddressProperty?> adrPropEnumerable => adrPropEnumerable.Select(cloner).Cast <AddressProperty?>().ToArray(), NameProperty nameProp => nameProp.Clone(), IEnumerable <NameProperty?> namePropEnumerable => namePropEnumerable.Select(cloner).Cast <NameProperty?>().ToArray(), RelationProperty relProp => relProp.Clone(), IEnumerable <RelationProperty?> relPropEnumerable => relPropEnumerable.Select(cloner).Cast <RelationProperty?>().ToArray(), OrganizationProperty orgProp => orgProp.Clone(), IEnumerable <OrganizationProperty?> orgPropEnumerable => orgPropEnumerable.Select(cloner).Cast <OrganizationProperty?>().ToArray(), StringCollectionProperty strCollProp => strCollProp.Clone(), IEnumerable <StringCollectionProperty?> strCollPropEnumerable => strCollPropEnumerable.Select(cloner).Cast <StringCollectionProperty?>().ToArray(), GenderProperty sexProp => sexProp.Clone(), IEnumerable <GenderProperty?> sexPropEnumerable => sexPropEnumerable.Select(cloner).Cast <GenderProperty?>().ToArray(), GeoProperty geoProp => geoProp.Clone(), IEnumerable <GeoProperty?> geoPropEnumerable => geoPropEnumerable.Select(cloner).Cast <GeoProperty?>().ToArray(), DataProperty dataProp => dataProp.Clone(), IEnumerable <DataProperty?> dataPropEnumerable => dataPropEnumerable.Select(cloner).Cast <DataProperty?>().ToArray(), NonStandardProperty nStdProp => nStdProp.Clone(), IEnumerable <NonStandardProperty?> nStdPropEnumerable => nStdPropEnumerable.Select(cloner).Cast <NonStandardProperty?>().ToArray(), PropertyIDMappingProperty pidMapProp => pidMapProp.Clone(), IEnumerable <PropertyIDMappingProperty?> pidMapPropEnumerable => pidMapPropEnumerable.Select(cloner).Cast <PropertyIDMappingProperty?>().ToArray(), TimeZoneProperty tzProp => tzProp.Clone(), IEnumerable <TimeZoneProperty?> tzPropEnumerable => tzPropEnumerable.Select(cloner).Cast <TimeZoneProperty?>().ToArray(), ICloneable cloneable => cloneable.Clone(), // AccessProperty, KindProperty, TimeStampProperty, UuidProperty _ => kvp.Value });