本文整理汇总了C#中Contact.AddAddress方法的典型用法代码示例。如果您正苦于以下问题:C# Contact.AddAddress方法的具体用法?C# Contact.AddAddress怎么用?C# Contact.AddAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contact
的用法示例。
在下文中一共展示了Contact.AddAddress方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddAddressProperty
private void AddAddressProperty(Contact cContact)
{
if (this.propertyList != null)
{
AddressTypes addrTypes = 0;
Address cAddress = new Address();
foreach(string propertyString in this.propertyList)
{
Regex p = new Regex(@";");
IEnumerator propertyTokens = p.Split(propertyString).GetEnumerator();
while(propertyTokens.MoveNext())
{
Regex o = new Regex(@"=");
IEnumerator propValueTokens = o.Split((string) propertyTokens.Current).GetEnumerator();
while(propValueTokens.MoveNext())
{
string token = (string) propValueTokens.Current;
token.ToLower();
if (token.StartsWith("pref"))
{
cAddress.Preferred = true;
}
else
if (token == "street")
{
if (propValueTokens.MoveNext())
{
cAddress.Street = (string) propValueTokens.Current;
}
}
else
if (token == "locality")
{
if (propValueTokens.MoveNext())
{
if (verbose == true)
{
Console.WriteLine("Locality: " + (string) propValueTokens.Current);
}
cAddress.Locality = (string) propValueTokens.Current;
}
}
else
if (token == "region")
{
if (propValueTokens.MoveNext())
{
if (verbose == true)
{
Console.WriteLine("Region: " + (string) propValueTokens.Current);
}
cAddress.Region = (string) propValueTokens.Current;
}
}
else
if (token == "pcode")
{
if (propValueTokens.MoveNext())
{
cAddress.PostalCode = (string) propValueTokens.Current;
}
}
else
if (token == "pbox")
{
if (propValueTokens.MoveNext())
{
cAddress.PostalBox = (string) propValueTokens.Current;
}
}
else
if (token == "country")
{
if (propValueTokens.MoveNext())
{
cAddress.Country = (string) propValueTokens.Current;
}
}
else
if (token == "work")
{
addrTypes |= AddressTypes.work;
}
else
if (token == "home")
{
addrTypes |= AddressTypes.home;
}
else
if (token == "other")
{
addrTypes |= AddressTypes.other;
}
else
if (token == "dom")
{
addrTypes |= AddressTypes.dom;
}
else
if (token == "intl")
//.........这里部分代码省略.........