本文整理汇总了C#中Contacts.AddRange方法的典型用法代码示例。如果您正苦于以下问题:C# Contacts.AddRange方法的具体用法?C# Contacts.AddRange怎么用?C# Contacts.AddRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contacts
的用法示例。
在下文中一共展示了Contacts.AddRange方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetContactsByName
public Contacts GetContactsByName(string contactName)
{
Contacts myContacts = new Contacts();
SelectRequest request = new SelectRequest
{
SelectExpression = string.Format("SELECT * FROM {0} where Name='{1}' ", DomainName, contactName)
};
SelectResponse response = SimpleDBProxy.Service.Select(request);
var contacts = from item in response.SelectResult.Item
select new Contact()
{
Email = item.Attribute.GetValueByName("Email"),
Name = item.Attribute.GetValueByName("Name"),
Phone = item.Attribute.GetValueByName("Phone"),
ID = item.Name
};
myContacts.AddRange(contacts);
return myContacts;
}
示例2: vimeo_groups_getMembers
//.getMembers
public Contacts vimeo_groups_getMembers(string group_id, ChannelsSortMethods sortMethod=ChannelsSortMethods.Default, int? page=null, int? per_page=null)
{
var parameters = new Dictionary<string, string> { { "group_id", group_id } };
if (page.HasValue) parameters.Add("page", page.Value.ToString());
if (per_page.HasValue) parameters.Add("per_page", per_page.Value.ToString());
var x = ExecuteGetRequest("vimeo.groups.getMembers", parameters);
if (!IsResponseOK(x)) return null;
var e = x.Element("rsp").Element("members");
var cs = new Contacts
{
on_this_page = int.Parse(e.Attribute("on_this_page").Value),
page = int.Parse(e.Attribute("page").Value),
perpage = int.Parse(e.Attribute("perpage").Value),
total = int.Parse(e.Attribute("total").Value)
};
cs.AddRange(e.Elements("member").Select(Contact.FromElement));
return cs;
}