本文整理汇总了C#中LinqToTwitter.List.Any方法的典型用法代码示例。如果您正苦于以下问题:C# List.Any方法的具体用法?C# List.Any怎么用?C# List.Any使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinqToTwitter.List
的用法示例。
在下文中一共展示了List.Any方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteMemberRangeFromListAsync
/// <summary>
/// Deletes membership for a comma-separated list of users.
/// </summary>
/// <param name="listID">ID of list.</param>
/// <param name="slug">Name of list to remove from.</param>
/// <param name="userIds">List of user IDs of users to remove from list membership.</param>
/// <param name="screenNames">List of screen names of users to remove from list membership.</param>
/// <param name="ownerID">ID of users who owns the list.</param>
/// <param name="ownerScreenName">Screen name of user who owns the list.</param>
/// <returns>List info for list subscription removed from</returns>
async Task<List> DeleteMemberRangeFromListAsync(ulong listID, string slug, List<ulong> userIDs, List<string> screenNames, ulong ownerID, string ownerScreenName, CancellationToken cancelToken = default(CancellationToken))
{
if (listID == 0 && string.IsNullOrWhiteSpace(slug))
throw new ArgumentException("Either listID or slug is required.", ListIDOrSlugParam);
if (listID == 0 && !string.IsNullOrWhiteSpace(slug) &&
ownerID == 0 && string.IsNullOrWhiteSpace(ownerScreenName))
throw new ArgumentException("If using slug, you must also provide either ownerID or ownerScreenName.", OwnerIDOrOwnerScreenNameParam);
if ((userIDs != null && userIDs.Count > 100) ||
(screenNames != null && screenNames.Count > 100))
throw new ArgumentException("You can only remove 100 members at a Time.", "userIDs");
var destroyAllUrl = BaseUrl + "lists/members/destroy_all.json";
var reqProc = new ListRequestProcessor<List>();
var parameters = new Dictionary<string, string>();
if (listID != 0)
parameters.Add("list_id", listID.ToString());
if (!string.IsNullOrWhiteSpace(slug))
parameters.Add("slug", slug);
if (userIDs != null && userIDs.Any())
parameters.Add("user_id", string.Join(",", userIDs.Select(id => id.ToString(CultureInfo.InvariantCulture)).ToArray()));
if (screenNames != null && screenNames.Any())
parameters.Add("screen_name", string.Join(",", screenNames));
if (ownerID != 0)
parameters.Add("owner_id", ownerID.ToString());
if (!string.IsNullOrWhiteSpace(ownerScreenName))
parameters.Add("owner_screen_name", ownerScreenName);
RawResult =
await TwitterExecutor.PostToTwitterAsync<List>(destroyAllUrl, parameters, cancelToken).ConfigureAwait(false);
return reqProc.ProcessActionResult(RawResult, ListAction.DestroyAll);
}