本文整理汇总了C#中IEnumerable.Vectorize方法的典型用法代码示例。如果您正苦于以下问题:C# IEnumerable.Vectorize方法的具体用法?C# IEnumerable.Vectorize怎么用?C# IEnumerable.Vectorize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEnumerable
的用法示例。
在下文中一共展示了IEnumerable.Vectorize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetComments
public virtual void GetComments(IEnumerable<int> fromUserIds, Action<IPagedList<Comment>> onSuccess, Action<ApiException> onError, CommentOptions options)
{
string[] urlParameters = null;
if (options.ToUserId.HasValue)
{
urlParameters = new string[] { fromUserIds.Vectorize(), "comments", options.ToUserId.ToString() };
}
else
{
urlParameters = new string[] { fromUserIds.Vectorize(), "comments" };
}
MakeRequest<CommentResponse>("users", urlParameters, new
{
key = apiKey,
page = options.Page ?? null,
pagesize = options.PageSize ?? null,
fromdate = options.FromDate.HasValue ? (long?)options.FromDate.Value.ToUnixTime() : null,
todate = options.ToDate.HasValue ? (long?)options.ToDate.Value.ToUnixTime() : null,
sort = options.SortBy.ToString().ToLower(),
order = GetSortDirection(options.SortDirection),
min = options.Min ?? null,
max = options.Max ?? null
}, (items) => onSuccess(new PagedList<Comment>(items.Comments, items)), onError);
}
示例2: GetUserBadges
public virtual IEnumerable<Badge> GetUserBadges(IEnumerable<int> userIds)
{
return MakeRequest<BadgeResponse>("users", new string[] { userIds.Vectorize(), "badges" }, new
{
key = apiKey
}).Badges;
}
示例3: GetUsers
public virtual void GetUsers(IEnumerable<int> userIds, Action<IPagedList<User>> onSuccess, Action<ApiException> onError = null)
{
MakeRequest<UserResponse>("users", new string[] { userIds.Vectorize() }, new
{
key = apiKey
}, (items) => onSuccess(new PagedList<User>(items.Users, items)), onError);
}
示例4: GetUserTimeline
public virtual void GetUserTimeline(IEnumerable<int> userIds, Action<IPagedList<UserEvent>> onSuccess, Action<ApiException> onError = null, DateTime? fromDate = null, DateTime? toDate = null)
{
MakeRequest<UserEventResponse>("users", new string[] { userIds.Vectorize(), "timeline" }, new
{
key = apiKey,
fromdate = fromDate.HasValue ? (long?)fromDate.Value.ToUnixTime() : null,
todate = toDate.HasValue ? (long?)toDate.Value.ToUnixTime() : null
}, (items) => onSuccess(new PagedList<UserEvent>(items.Events, items)), onError);
}
示例5: GetRevisions
public virtual IEnumerable<Revision> GetRevisions(IEnumerable<int> ids, DateTime? fromDate, DateTime? toDate)
{
return MakeRequest<RevisionResponse>("revisions", new string[] { ids.Vectorize() }, new
{
key = apiKey,
fromdate = fromDate.HasValue ? (long?)fromDate.Value.ToUnixTime() : null,
todate = toDate.HasValue ? (long?)toDate.Value.ToUnixTime() : null
}).Revisions;
}
示例6: GetRevisions
public virtual void GetRevisions(IEnumerable<int> ids, Action<IEnumerable<Revision>> onSuccess, Action<ApiException> onError = null, DateTime? fromDate = null, DateTime? toDate = null)
{
MakeRequest<RevisionResponse>("revisions", new string[] { ids.Vectorize() }, new
{
key = apiKey,
fromdate = fromDate.HasValue ? (long?)fromDate.Value.ToUnixTime() : null,
todate = toDate.HasValue ? (long?)toDate.Value.ToUnixTime() : null
}, (items) => onSuccess(items.Revisions), onError);
}
示例7: GetUserReputation
public virtual void GetUserReputation(IEnumerable<int> userIds, Action<IPagedList<Reputation>> onSuccess, Action<ApiException> onError = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null)
{
MakeRequest<ReputationResponse>("users", new string[] { userIds.Vectorize(), "reputation" }, new
{
key = apiKey,
page = page ?? null,
pagesize = pageSize ?? null,
fromdate = fromDate.HasValue ? (long?)fromDate.Value.ToUnixTime() : null,
todate = toDate.HasValue ? (long?)toDate.Value.ToUnixTime() : null
}, (items) => onSuccess(new PagedList<Reputation>(items.Reputation, items)), onError);
}
示例8: GetUsersByBadge
public virtual void GetUsersByBadge(IEnumerable<int> userIds, Action<IPagedList<User>> onSuccess, Action<ApiException> onError, BadgeByUserOptions options)
{
MakeRequest<UserResponse>("badges", new string[] { userIds.Vectorize(), "badges" }, new
{
key = apiKey,
page = options.Page ?? null,
pagesize = options.PageSize ?? null,
fromdate = options.FromDate.HasValue ? (long?)options.FromDate.Value.ToUnixTime() : null,
todate = options.ToDate.HasValue ? (long?)options.ToDate.Value.ToUnixTime() : null
}, (items) => onSuccess(new PagedList<User>(items.Users, items)), onError);
}
示例9: GetUsersByBadge
public virtual void GetUsersByBadge(IEnumerable<int> badgeId, Action<IPagedList<User>> onSuccess, Action<ApiException> onError = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null)
{
MakeRequest<UserResponse>("badges", new string[] { badgeId.Vectorize() }, new
{
key = apiKey,
page = page ?? null,
pagesize = pageSize ?? null,
fromdate = fromDate.HasValue ? (long?)fromDate.Value.ToUnixTime() : null,
todate = toDate.HasValue ? (long?)toDate.Value.ToUnixTime() : null
}, (items) => onSuccess(new PagedList<User>(items.Users, items)), onError);
}
示例10: GetQuestionTimeline
public virtual void GetQuestionTimeline(IEnumerable<int> questionIds, Action<IPagedList<PostEvent>> onSuccess, Action<ApiException> onError = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null)
{
MakeRequest<QuestionTimelineResponse>("questions", new string[] { questionIds.Vectorize(), "timeline" }, new
{
key = apiKey,
fromdate = fromDate.HasValue ? (long?)fromDate.Value.ToUnixTime() : null,
todate = toDate.HasValue ? (long?)toDate.Value.ToUnixTime() : null,
page = page ?? null,
pagesize = pageSize ?? null
}, (items) => onSuccess(new PagedList<PostEvent>(items.Events, items)), onError);
}
示例11: GetQuestionTimeline
public virtual IPagedList<PostEvent> GetQuestionTimeline(IEnumerable<int> questionIds, QuestionTimelineOptions options)
{
var response = MakeRequest<QuestionTimelineResponse>("questions", new string[] { questionIds.Vectorize(), "timeline" }, new
{
key = apiKey,
page = options.Page ?? null,
pagesize = options.PageSize ?? null,
fromdate = options.FromDate.HasValue ? (long?)options.FromDate.Value.ToUnixTime() : null,
todate = options.ToDate.HasValue ? (long?)options.ToDate.Value.ToUnixTime() : null
});
return new PagedList<PostEvent>(response.Events, response);
}
示例12: GetQuestions
public virtual void GetQuestions(IEnumerable<int> questionIds, Action<IPagedList<Question>> onSuccess, Action<ApiException> onError = null, int? page = null, int? pageSize = null, bool includeBody = false, bool includeComments = false, bool includeAnswers = false)
{
MakeRequest<QuestionResponse>("questions", new string[] { questionIds.Vectorize() }, new
{
key = apiKey,
body = includeBody ? (bool?)true : null,
comments = includeComments ? (bool?)true : null,
answers = includeAnswers ? (bool?)true : null,
page = page ?? null,
pagesize = pageSize ?? null
}, (items) => onSuccess(new PagedList<Question>(items.Questions, items)), onError);
}
示例13: GetCommentsByPost
public virtual void GetCommentsByPost(IEnumerable<int> postIds, Action<IPagedList<Comment>> onSuccess, Action<ApiException> onError, CommentsByPostOptions options)
{
MakeRequest<CommentResponse>("posts", new string[] { postIds.Vectorize(), "comments" }, new
{
key = apiKey,
page = options.Page ?? null,
pagesize = options.PageSize ?? null,
fromdate = options.FromDate.HasValue ? (long?)options.FromDate.Value.ToUnixTime() : null,
todate = options.ToDate.HasValue ? (long?)options.ToDate.Value.ToUnixTime() : null,
sort = options.SortBy.ToString().ToLower(),
order = GetSortDirection(options.SortDirection),
}, (items) => onSuccess(new PagedList<Comment>(items.Comments, items)), onError);
}
示例14: GetCommentsByPost
public virtual void GetCommentsByPost(IEnumerable<int> postIds, Action<IPagedList<Comment>> onSuccess, Action<ApiException> onError = null, CommentSort sortBy = CommentSort.Creation, SortDirection sortDirection = SortDirection.Descending, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null)
{
MakeRequest<CommentResponse>("posts", new string[] { postIds.Vectorize(), "comments" }, new
{
key = apiKey,
page = page ?? null,
pagesize = pageSize ?? null,
fromdate = fromDate.HasValue ? (long?)fromDate.Value.ToUnixTime() : null,
todate = toDate.HasValue ? (long?)toDate.Value.ToUnixTime() : null,
sort = sortBy.ToString().ToLower(),
order = GetSortDirection(sortDirection),
}, (items) => onSuccess(new PagedList<Comment>(items.Comments, items)), onError);
}
示例15: GetComments
public virtual void GetComments(IEnumerable<int> fromUserIds, Action<IPagedList<Comment>> onSuccess, Action<ApiException> onError = null, CommentSort sortBy = CommentSort.Creation, SortDirection sortDirection = SortDirection.Descending, int? toUserId = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null)
{
string[] urlParameters = null;
if (toUserId.HasValue)
{
urlParameters = new string[] { fromUserIds.Vectorize(), "comments", toUserId.ToString() };
}
else
{
urlParameters = new string[] { fromUserIds.Vectorize(), "comments" };
}
MakeRequest<CommentResponse>("users", urlParameters, new
{
key = apiKey,
page = page ?? null,
pagesize = pageSize ?? null,
fromdate = fromDate.HasValue ? (long?)fromDate.Value.ToUnixTime() : null,
todate = toDate.HasValue ? (long?)toDate.Value.ToUnixTime() : null,
sort = sortBy.ToString().ToLower(),
order = GetSortDirection(sortDirection)
}, (items) => onSuccess(new PagedList<Comment>(items.Comments, items)), onError);
}