本文整理汇总了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);
}
}
示例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
//.........这里部分代码省略.........