当前位置: 首页>>代码示例>>C#>>正文


C# vCard.ToString方法代码示例

本文整理汇总了C#中Thought.vCards.vCard.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# vCard.ToString方法的具体用法?C# vCard.ToString怎么用?C# vCard.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Thought.vCards.vCard的用法示例。


在下文中一共展示了vCard.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SamplevCardReadAndWriteTestWithEmailTypeFormat

        public void SamplevCardReadAndWriteTestWithEmailTypeFormat()
        {

            vCard card = new vCard();

            card.EmailAddresses.Add(new vCardEmailAddress() { Address = "[email protected]", EmailType = vCardEmailAddressType.Internet, IsPreferred = true, ItemType = ItemType.WORK });


            card.UniqueId = Guid.NewGuid().ToString("N");

            string text = card.ToString();

            vCardStandardWriter writer = new vCardStandardWriter();

            using (StringWriter sw = new StringWriter())
            {

                writer.Write(card, sw);

                sw.Flush();
                text = sw.ToString();
                sw.Close();
            }


            Assert.IsNotNull(text);


            vCardStandardReader reader = new vCardStandardReader();

            using (StringReader sr = new StringReader(text))
            {

                vCard cardFromReader = reader.Read(sr);

                Assert.AreEqual(1, cardFromReader.EmailAddresses.Count);

                var email = cardFromReader.EmailAddresses.First();
                Assert.AreEqual(true, email.IsPreferred);
                Assert.AreEqual(ItemType.WORK, email.ItemType);
                Assert.AreEqual(vCardEmailAddressType.Internet, email.EmailType);
                Assert.AreEqual("[email protected]", email.Address);
            }

        }
开发者ID:bobeverland,项目名称:Thought.vCards,代码行数:45,代码来源:IntegrationTest.cs

示例2: Equals

        // The following functions compare two vCard-related objects.
        
        #region [ Equals(vCard) ]

        public static void Equals(vCard c1, vCard c2)
        {

            // Start by comparing the base fields.

            Assert.AreEqual(
                c1.AdditionalNames,
                c2.AdditionalNames,
                "AdditionalNames does not match.");

            Assert.AreEqual(
                c1.BirthDate,
                c2.BirthDate,
                "BirthDate does not match.");

            Assert.AreEqual(
                c1.DisplayName,
                c2.DisplayName,
                "DisplayName does not match.");

            Assert.AreEqual(
                c1.FamilyName,
                c2.FamilyName,
                "FamilyName does not match.");

            Assert.AreEqual(
                c1.FormattedName,
                c2.FormattedName,
                "FormattedName does not match.");

            Assert.AreEqual(
                c1.Gender,
                c2.Gender,
                "Gender does not match.");

            Assert.AreEqual(
                c1.GivenName,
                c2.GivenName,
                "GivenName does not match.");

            Assert.AreEqual(
                c1.Mailer,
                c2.Mailer,
                "Mailer does not match.");

            Assert.AreEqual(
                c1.NamePrefix,
                c2.NamePrefix,
                "NamePrefix does not match.");

            Assert.AreEqual(
                c1.NameSuffix,
                c2.NameSuffix,
                "NameSuffix does not match.");

            Assert.AreEqual(
                c1.Organization,
                c2.Organization,
                "Organization does not match.");

            Assert.AreEqual(
                c1.ProductId,
                c2.ProductId,
                "ProductId does not match.");

            Assert.AreEqual(
                c1.RevisionDate,
                c2.RevisionDate,
                "RevisionDate does not match.");

            Assert.AreEqual(
                c1.Role,
                c2.Role,
                "Role does not match.");

            Assert.AreEqual(
                c1.TimeZone,
                c2.TimeZone,
                "TimeZone does not match.");

            Assert.AreEqual(
                c1.Title,
                c2.Title,
                "Title does not match.");

            Assert.AreEqual(
                c1.ToString(),
                c2.ToString(),
                "ToString() does not match.");

            Assert.AreEqual(
                c1.UniqueId,
                c2.UniqueId,
                "UniqueId does not match.");

            // Compare collections
//.........这里部分代码省略.........
开发者ID:richardsalt,项目名称:Thought.vCards,代码行数:101,代码来源:Helper.cs


注:本文中的Thought.vCards.vCard.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。