Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linq to twitter 状态中缺少分页属性_Linq To Twitter - Fatal编程技术网

Linq to twitter 状态中缺少分页属性

Linq to twitter 状态中缺少分页属性,linq-to-twitter,Linq To Twitter,在最新版本的LinqtoTwitter v2.1.08中,不再支持分页。如何在没有页面属性的情况下获取特定页面 干杯 int curPageIndex=5; string pageindex="5"; string cmd = "next"; using (var twitterCtx = new TwitterContext(myauth)) { try { // set up the "main query" IQueryable<Statu

在最新版本的LinqtoTwitter v2.1.08中,不再支持分页。如何在没有页面属性的情况下获取特定页面

干杯

int curPageIndex=5;
string pageindex="5";
string cmd = "next";
using (var twitterCtx = new TwitterContext(myauth))
  {
    try
    {
      // set up the "main query"
      IQueryable<Status> test = from tweet in twitterCtx.Status select tweet;


      switch (cmd)
      {
        case "prev":

          test = pageindex.Length > 0
                   ? test.Where(p => p.Type == StatusType.Home && p.Page == curPageIndex)                       
                   : test.Where(p => p.Type == StatusType.Home);
          break;
        case "next":
          test = pageindex.Length > 0
                   ? test.Where(p => p.Type == StatusType.Home && p.Page == curPageIndex)                       
                   : test.Where(p => p.Type == StatusType.Home);
          break;
        default:              
          //
          test = test.Where(p => p.Type == StatusType.Home);
          break;
      }        
int curPageIndex=5;
字符串pageindex=“5”;
string cmd=“next”;
使用(var twitterCtx=newtwittercontext(myauth))
{
尝试
{
//设置“主查询”
IQueryable test=来自twitterCtx中的tweet。状态选择tweet;
开关(cmd)
{
案例“prev”:
测试=页面索引。长度>0
?test.Where(p=>p.Type==StatusType.Home&&p.Page==curPageIndex)
:test.Where(p=>p.Type==StatusType.Home);
打破
案例“下一个”:
测试=页面索引。长度>0
?test.Where(p=>p.Type==StatusType.Home&&p.Page==curPageIndex)
:test.Where(p=>p.Type==StatusType.Home);
打破
违约:
//
test=test.Where(p=>p.Type==StatusType.Home);
打破
}        

解决方案:将页面参数更改为SinceID和MaxID

//Get the statusids in the query, add or subtract so you skip current id's
ulMaxId = test.Min(status => ulong.Parse(status.StatusID)) - 1;
ulSinceID = test.Max(status => ulong.Parse(status.StatusID)) + 1;

//Return ID above and use them in future calls (below)

//Now you can navigate timelines, depending if you are stepping forward or backwards

? test.Where(p => p.Type == StatusType.Home && p.SinceID == ulong.Parse(sinceid)
...
? test.Where(p => p.Type == StatusType.Home && p.MaxID == ulong.Parse(maxid))

解决方案:将页面参数更改为SinceID和MaxID

//Get the statusids in the query, add or subtract so you skip current id's
ulMaxId = test.Min(status => ulong.Parse(status.StatusID)) - 1;
ulSinceID = test.Max(status => ulong.Parse(status.StatusID)) + 1;

//Return ID above and use them in future calls (below)

//Now you can navigate timelines, depending if you are stepping forward or backwards

? test.Where(p => p.Type == StatusType.Home && p.SinceID == ulong.Parse(sinceid)
...
? test.Where(p => p.Type == StatusType.Home && p.MaxID == ulong.Parse(maxid))

Twitter API v1.1删除了页面参数,支持自id和最大id。您可能已经看到了这一点,但我会发布它,以防其他人也有同样的问题-使用LINQ to Twitter的时间线:Twitter API v1.1删除了页面参数,支持自id和最大id。您可能已经看到了这一点,但我会发布它,以防其他人看到同样的问题-与LINQ to Twitter一起使用时间表: