当前位置: 首页>>代码示例>>C#>>正文


C# List.Contains方法代码示例

本文整理汇总了C#中LinqToTwitter.List.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# List.Contains方法的具体用法?C# List.Contains怎么用?C# List.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LinqToTwitter.List的用法示例。


在下文中一共展示了List.Contains方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: QueryAccountsFromCache

 private List<Domain.Model.Account> QueryAccountsFromCache(List<string> Ids)
 {
     return (from x in this.accountCache
             where Ids.Contains(x.Key)
             select (Domain.Model.Account)x.Value).ToList();
 }
开发者ID:jefferydalton,项目名称:TwitterAnalyzer,代码行数:6,代码来源:AccountQueryRepositoryLinqToTwitter.cs

示例2: GetTweets

        private List<ITweet> GetTweets(string screenname, bool includeRelevantScreenNames, List<ulong> excludeStatusIDs = null)
        {
            List<string> screenNames = null;

            var user = UsersCollection.Single(screenname);

            if (includeRelevantScreenNames)
                screenNames = GetRelevantScreenNames(screenname);
            else
                screenNames = new List<string> { screenname.ToLower() };

            int RetweetThreshold = UsersCollection.PrimaryUser().RetweetThreshold;

            Expression<Func<Tweet, bool>> where = t =>
                //If there are any IDs we want to filter out
                (excludeStatusIDs == null || !excludeStatusIDs.Contains(t.StatusID)) &&
                //Should everything be displayed or do you only want content
                (user.OnlyTweetsWithLinks == false || (t.Links != null && t.Links.Count > 0)) &&
                //Minumum threshold applied so we get results worth seeing (if it is your own tweet it gets a pass on this step)
                ((t.RetweetCount >= RetweetThreshold /*&& t.CreatedAt > DateTime.Now.AddHours(-48)*/) || t.User.Identifier.ScreenName.ToLower() == screenname.ToLower());

            var tweets = screenNames
                //For each screen name (i.e. - you and your friends if included) select the most recent tweets
                .SelectMany(x => Repository<Tweet>.Instance.Query(x + TWEETS, limit: Repository<Tweet>.Limit.Limit100, where: where) ?? new List<Tweet>())
                //Order all tweets based on rank
                .OrderByDescending(t => t.TweetRank)
                .Distinct(Tweet.GetTweetTextComparer())
                .ToList();

            if(!string.IsNullOrEmpty(UsersCollection.PrimaryUser().Track))
                tweets.AddRange(Repository<Tweet>.Instance.Query(TRACKER + TWEETS, limit: Repository<Tweet>.Limit.Limit1000, where: where) ?? new List<Tweet>());

            return tweets.Cast<ITweet>().ToList();
        }
开发者ID:rickyn,项目名称:postworthy,代码行数:34,代码来源:TwitterModel.cs


注:本文中的LinqToTwitter.List.Contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。