示例#1
0
        public static string Serialize(this VCard vcard)
        {
            var builder = new StringBuilder();

            builder.Append("BEGIN:VCARD");
            builder.Append(Environment.NewLine);

            builder.Append(V2Serializer.Serialize(vcard));

            // f**k versions, I wanna all my fields
            builder.Append(V3Serializer.Serialize(vcard));
            builder.Append(V3Serializer.Serialize(vcard));
            builder.Append(V4Serializer.Serialize(vcard));


            builder.Append("END:VCARD");
            builder.Append(Environment.NewLine);
            return(builder.ToString());
        }
        public static string Serialize(this VCard vcard)
        {
            var builder = new StringBuilder();

            builder.Append("BEGIN:VCARD");
            builder.Append(Environment.NewLine);

            builder.Append(V2Serializer.Serialize(vcard));

            if (vcard.Version == VCardVersion.V3)
            {
                builder.Append(V3Serializer.Serialize(vcard));
            }
            else if (vcard.Version == VCardVersion.V4)
            {
                builder.Append(V3Serializer.Serialize(vcard));
                builder.Append(V4Serializer.Serialize(vcard));
            }


            builder.Append("END:VCARD");
            builder.Append(Environment.NewLine);
            return(builder.ToString());
        }