如何使用MonoTouch c#从iPhone联系人中获取手机号码和工作号码?我用了这段代码,
ABMultiValue<String> phoneMV = person.GetPhones();
String[] phoneval = phoneMV.GetValues();
for(int i = 0; i< phoneval.Length; i++) {
Console.WriteLine(phoneval[i]);
}但它会打印联系人号码的所有值。如何从联系人中获取特定属性?例如,我需要手机和工作电话号码,家庭和工作电子邮件id就像这样。我不想要所有的值。如何做到这一点?
发布于 2011-03-30 00:14:42
ABMultiValue是ABMultiValueEntry值的集合。电话号码的类型(工作、家庭等)存储在ABMultiValueEntry.Label属性中,您可以与ABLabel.Work等进行比较
IEnumerable<ABMultiValueEntry<string>> workPhoneEntries = person.GetPhones()
.Where(p => p.Label == ABLabel.Work);
IEnumerable<string> workNumbers = workPhoneEntries.Select(p => p.Value);https://stackoverflow.com/questions/5470963
复制相似问题