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


C# ReadOnlyCollection.Sum方法代码示例

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


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

示例1: IpV6MobilityOptionContextRequest

 /// <summary>
 /// Creates an instance from a collection of requests.
 /// </summary>
 /// <param name="requests">The requests types and options.</param>
 public IpV6MobilityOptionContextRequest(ReadOnlyCollection<IpV6MobilityOptionContextRequestEntry> requests)
     : base(IpV6MobilityOptionType.ContextRequest)
 {
     Requests = requests;
     _dataLength = OptionDataMinimumLength + Requests.Sum(request => request.Length);
     if (_dataLength > byte.MaxValue)
         throw new ArgumentOutOfRangeException("requests", requests,
                                               string.Format(CultureInfo.InvariantCulture, "requests length is too large. Takes over {0}>{1} bytes.",
                                                             _dataLength, byte.MaxValue));
 }
开发者ID:amitla,项目名称:Pcap.Net,代码行数:14,代码来源:IpV6MobilityOptionContextRequest.cs

示例2: StatementAccount

        internal StatementAccount(StatementInfo parent, string accountName)
        {
            Parent = parent;
            AccountName = accountName;
            OutstandingBalance = Parent.Person.GetBalance(Parent.StartDate, AccountName);
            BalanceDue = Math.Max(0, Parent.Person.GetBalance(AccountName));

            Func<ITransaction, bool> filter = t => t.Date >= Parent.StartDate && t.Date < Parent.EndDate && t.Account == AccountName;

            Pledges = new ReadOnlyCollection<Pledge>(Parent.Person.Pledges.Where(p => filter(p)).OrderBy(p => p.Date).ToArray());
            Payments = new ReadOnlyCollection<Payment>(Parent.Person.Payments.Where(p => filter(p)).OrderBy(p => p.Date).ToArray());

            TotalPledged = OutstandingBalance + Pledges.Sum(p => p.Amount);
            TotalPaid = Payments.Sum(p => p.Amount);
        }
开发者ID:ShomreiTorah,项目名称:Libraries,代码行数:15,代码来源:StatementInfo.cs

示例3: StrokeMatch

 public StrokeMatch(IEnumerable<StrokePartMatch> parts)
 {
     Parts = new ReadOnlyCollection<StrokePartMatch>(parts.ToArray());
     Cost = Parts.Sum(p => p.MinCost);
     //Cost = Parts.Count * (Cost + 0.001f *parts.Sum(p=>p.Delta.LengthSquared));
 }
开发者ID:CodesInChaos,项目名称:KanjiRecognition,代码行数:6,代码来源:StrokeMatch.cs

示例4: Recalculate

        public void Recalculate()
        {
            if (Person.Schema.Columns.Contains("BalanceDue"))
                TotalBalance = Math.Max(0, Person.Field<decimal>("BalanceDue"));
            else
                TotalBalance = Person.Pledges.Concat<ITransaction>(Person.Payments).Sum(t => t.SignedAmount);

            Accounts = new ReadOnlyCollection<StatementAccount>(
                Names.AccountNames.Select(a => new StatementAccount(this, a))
                                  .Where(ba => ba.ShouldInclude)
                                  .ToArray()
            );

            TotalPledged = Accounts.Sum(a => a.TotalPledged);
            TotalPaid = Accounts.Sum(a => a.TotalPaid);

            Deductibility = String.Join("  ", CalcDeductibility());

            if (data.Table<Payment>().Rows.Any())
                LastEnteredPayment = data.Table<Payment>().Rows.Max(p => p.Modified);
            else if (data.Table<Pledge>().Rows.Any())
                LastEnteredPayment = data.Table<Pledge>().Rows.Max(p => p.Modified);
            else
                LastEnteredPayment = new DateTime(1970, 1, 1);
        }
开发者ID:ShomreiTorah,项目名称:Libraries,代码行数:25,代码来源:StatementInfo.cs


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