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


C# IGrouping.SelectMany方法代码示例

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


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

示例1: TweetGroup

 public TweetGroup(IGrouping<ITweet, ITweet> tg)
 {
     GroupStatusIDs = tg.Select(g => g.StatusID).ToList();
     CreatedOn = DateTime.Now;
     StatusID = tg.Key.StatusID;
     TweetText = tg.Key.TweetText;
     CreatedAt = tg.Key.CreatedAt;
     TweetTime = tg.Key.TweetTime;
     RetweetCount = tg.Key.RetweetCount + tg.Where(t => t.User.ScreenName != tg.Key.User.ScreenName).Sum(t => t.RetweetCount);
     LinkRetweetCount = tg.SelectMany(x => x.Links).Sum(x => x.UrlTweetCount);
     LinkFacebookShareCount = tg.SelectMany(x => x.Links).Sum(x => x.UrlFacebookShareCount);
     User = tg.Key.User;
     Links = tg.Where(t => t.User.ScreenName != tg.Key.User.ScreenName).SelectMany(x => x.Links).ToList();
     Links.AddRange(tg.Key.Links.Where(l => l.Image != null || l.Video != null));
 }
开发者ID:postworthy,项目名称:postworthy,代码行数:15,代码来源:TweetGroup.cs

示例2: CreateOneNamespaceDeclaration

 private static MemberDeclarationSyntax CreateOneNamespaceDeclaration(IGrouping<string, NamespaceDeclarationSyntax> ns)
 {
     var nameSyntax = SyntaxFactory.ParseName(ns.Key);
     return SyntaxFactory
         .NamespaceDeclaration(nameSyntax)
         .AddMembers(ns.SelectMany(x => x.Members)
         .ToArray());
 }
开发者ID:jhgbrt,项目名称:joincs,代码行数:8,代码来源:Joiner.cs

示例3: ComputeOffsetBetweenEvents

        private DataAroundEvent[] ComputeOffsetBetweenEvents(IGrouping<string, DataAroundEvent>[] orderEventGroups, IGrouping<string, DataAroundEvent> midGroup)
        {
            // compute offset between each event to center group
            DataAroundEvent[] repivotEvents;
            repivotEvents = orderEventGroups.SelectMany(@group =>
                @group.Select(d =>
                {
                    var eventPicked = @group.OrderByDescending(e => e.EventDate).FirstOrDefault(g => g.EventDate > DateTime.Today.AddDays(-numberOfPointsAroundEvent));
                    int busDayDiff = 0;
                    if (eventPicked != null)
                    {
                        busDayDiff = BusDayDiff(midGroup.OrderByDescending(e => e.EventDate).First(x => x.EventDate > DateTime.Today.AddDays(-numberOfPointsAroundEvent)).EventDate, eventPicked.EventDate);
                    }                    
                    var ar = new DataAroundEvent(d.EventDate, d.Instrument, d.RawData, d.NumPointsAroundEvent, d.EventCode, busDayDiff)
                    {
                        PivotIndex = pivotIndex,
                    };
                    return ar;
                })).ToArray();

            return repivotEvents;            

        }
开发者ID:heimanhon,项目名称:researchwork,代码行数:23,代码来源:MultiEventDisplayOrganiser.cs


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