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


C# ReadOnlyCollection.Count方法代码示例

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


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

示例1: PatternMatchRuleProcessor

        private PatternMatchRuleProcessor(ReadOnlyCollection<PatternMatchRule> rules)
        {
            Debug.Assert(rules.Count() != 0, "At least one PatternMatchRule is required");
            Debug.Assert(rules.Where(r => r == null).Count() == 0, "Individual PatternMatchRules must not be null");

            ruleSet = rules;
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:7,代码来源:PatternMatchRuleProcessor.cs

示例2: GetHandValue

        /// <summary>
        /// Gets the value of a hand and whether it is soft or not
        /// </summary>
        /// <param name="hand">The hand to evaluate</param>
        /// <param name="soft">[OUT] Is the hand's value soft?</param>
        /// <returns>The value of the specified hand</returns>
        public static int GetHandValue(ReadOnlyCollection<Card> hand, out bool soft)
        {
            int total = 0;

            foreach (Card c in hand)
            {
                total += s_cardValues[c.Value];
            }

            int aceCount = hand.Count(c => c.Value == CardName.Ace);
            while (total > 21 && aceCount > 0)
            {
                total -= 10;
                aceCount--;
            }

            soft = aceCount > 0;

            return total;
        }
开发者ID:Cakez0r,项目名称:CardcountSandbox,代码行数:26,代码来源:HandHelper.cs

示例3: PickBestMatch

        private static BindContext PickBestMatch(ReadOnlyCollection<BindContext> results)
        {
            // also pick not authenticated since subsequent reauthentication might lead to success
            var wannabes = results.Where(r => r.Result == BindResult.Success || r.Result == BindResult.NotAuthenticated).ToList();

            var dirty = true;
            while (dirty && results.Count() > 1)
            {
                var pairs = wannabes.SelectMany(r1 => wannabes.Select(r2 => Tuple.Create(r1, r2)));
                var resolvableConflict = pairs.FirstOrDefault(p =>
                {
                    var rp_prefix = p.Item1.ResourceTemplate.IndexOf("{") == -1 ? p.Item1.ResourceTemplate :
                        p.Item1.ResourceTemplate.Substring(0, p.Item1.ResourceTemplate.IndexOf("{"));
                    var rc_prefix = p.Item2.ResourceTemplate.IndexOf("{") == -1 ? p.Item2.ResourceTemplate :
                        p.Item2.ResourceTemplate.Substring(0, p.Item2.ResourceTemplate.IndexOf("{"));
                    return p.Item1 != p.Item2 && (rp_prefix.IsEmpty() || rc_prefix.StartsWith(rp_prefix));
                });

                if (resolvableConflict != null)
                {
                    wannabes.Remove(resolvableConflict.Item1);
                    dirty = true;
                }
                else
                {
                    dirty = false;
                }
            }

            return wannabes.Count() == 1 ? wannabes.Single() : null;
        }
开发者ID:xeno-by,项目名称:xenogears,代码行数:31,代码来源:DispatchContext.cs


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