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


C# ReadOnlyCollection.ForEach方法代码示例

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


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

示例1: OrgItem

        protected OrgItem(string name, IEnumerable<OrgItem> children)
        {
            Util.RequireNotNullOrEmpty(name, "name");

              if (children == null) {
            children = Enumerable.Empty<OrgItem>();
              }

              Name = name;
              m_children = new ReadOnlyCollection<OrgItem>(children.ToArray());
              m_children.ForEach(child => child.SetParent(this));
              m_isVisible = true;
        }
开发者ID:edealbag,项目名称:bot,代码行数:13,代码来源:OrgData.cs

示例2: OrgItem

        protected OrgItem(string name, IEnumerable<OrgItem> children)
        {
            Contract.Requires<ArgumentException>(!string.IsNullOrWhiteSpace(name));

            if (children == null)
            {
                children = Enumerable.Empty<OrgItem>();
            }

            Name = name;
            m_children = new ReadOnlyCollection<OrgItem>(children.ToArray());
            m_children.ForEach(child => child.SetParent(this));
            m_isVisible = true;
        }
开发者ID:hungdluit,项目名称:bot,代码行数:14,代码来源:OrgData.cs

示例3: VisitExpressionList

 /// <summary>
 /// Visits a Expression List
 /// </summary>
 /// <param name="list">Expression List</param>
 protected virtual void VisitExpressionList(ReadOnlyCollection<Expression> list)
 {
     list.ForEach<Expression>(e => Visit(e));
 }
开发者ID:daszat,项目名称:zetbox,代码行数:8,代码来源:ExpressionTreeVisitor.cs

示例4: VisitElementInitializerList

 /// <summary>
 /// Visits a ElementInitializer List
 /// </summary>
 /// <param name="list">ElementInit List</param>
 protected virtual void VisitElementInitializerList(ReadOnlyCollection<ElementInit> list)
 {
     list.ForEach<ElementInit>(e => VisitElementInitializer(e));
 }
开发者ID:daszat,项目名称:zetbox,代码行数:8,代码来源:ExpressionTreeVisitor.cs

示例5: VisitBindingList

 /// <summary>
 /// Visits a BindingList
 /// </summary>
 /// <param name="list">MemberBinding List</param>
 protected virtual void VisitBindingList(ReadOnlyCollection<MemberBinding> list)
 {
     list.ForEach<MemberBinding>(e => VisitBinding(e));
 }
开发者ID:daszat,项目名称:zetbox,代码行数:8,代码来源:ExpressionTreeVisitor.cs

示例6: VisitParameterList

 protected virtual ReadOnlyCollection<ParameterExpression> VisitParameterList(ReadOnlyCollection<ParameterExpression> list)
 {
     List<ParameterExpression> result = new List<ParameterExpression>();
     list.ForEach<ParameterExpression>(e => result.Add(VisitParameter(e)));
     return result.AsReadOnly();
 }
开发者ID:daszat,项目名称:zetbox,代码行数:6,代码来源:ExpressionTreeTranslator.cs

示例7: VisitExpressionList

 protected virtual ReadOnlyCollection<Expression> VisitExpressionList(ReadOnlyCollection<Expression> list)
 {
     List<Expression> result = new List<Expression>();
     list.ForEach<Expression>(e => result.Add(Visit(e)));
     return result.AsReadOnly();
 }
开发者ID:daszat,项目名称:zetbox,代码行数:6,代码来源:ExpressionTreeTranslator.cs

示例8: VisitElementInitializerList

 protected virtual ReadOnlyCollection<ElementInit> VisitElementInitializerList(ReadOnlyCollection<ElementInit> list)
 {
     List<ElementInit> result = new List<ElementInit>();
     list.ForEach<ElementInit>(e => result.Add(VisitElementInitializer(e)));
     return result.AsReadOnly();
 }
开发者ID:daszat,项目名称:zetbox,代码行数:6,代码来源:ExpressionTreeTranslator.cs

示例9: VisitBindingList

 protected virtual ReadOnlyCollection<MemberBinding> VisitBindingList(ReadOnlyCollection<MemberBinding> list)
 {
     List<MemberBinding> result = new List<MemberBinding>();
     list.ForEach<MemberBinding>(e => result.Add(VisitBinding(e)));
     return result.AsReadOnly();
 }
开发者ID:daszat,项目名称:zetbox,代码行数:6,代码来源:ExpressionTreeTranslator.cs

示例10: FixupEvaluationOrder

        private ReadOnlyCollection<Node> FixupEvaluationOrder(ReadOnlyCollection<Node> seq)
        {
            var q_evalOrders = new Dictionary<Node, ReadOnlyCollection<IILOp>>();
            seq.ForEach(q => q_evalOrders[q] = q.CSharpEvaluationOrder().Where(n => n != null)
                .Select(n => _map.GetOrDefault(n)).Where(op => op != null).ToReadOnly());
            var evalOrder = q_evalOrders.SelectMany(kvp => kvp.Value).ToReadOnly();

            var violatedDeps = new Dictionary<IILOp, ReadOnlyCollection<IILOp>>();
            evalOrder.ForEach((op, i_op) => violatedDeps.Add(op, evalOrder.Where(
                (oop, i_oop) => i_op > i_oop && op.Offset < oop.Offset).ToReadOnly()));
            violatedDeps.RemoveElements(kvp => kvp.Value.IsEmpty());

            if (violatedDeps.IsEmpty())
            {
                return seq;
            }
            else
            {
                var fixt = seq.ToList();

                foreach (var op in violatedDeps.Keys)
                {
                    if (op is Call)
                    {
                        var call = op.AssertCast<Call>();
                        if (call.Method.IsGetter()) /* implemented */ {}
                        else if (call.Method.IsSetter()) throw AssertionHelper.Fail();
                        else throw AssertionHelper.Fail();
                    }
                    else if (op is New) /* presume that ctors are stateless */ {}
                    else if (op is Ldloc) /* implemented */ {}
                    else if (op is Ldarg) /* implemented */ {}
                    else if (op is Ldelem) throw AssertionHelper.Fail();
                    else if (op is Ldfld) /* implemented */ {}
                    else if (op is Ldloca) /* implemented */ {}
                    else if (op is Ldarga) /* implemented */ {}
                    else if (op is Ldelema) throw AssertionHelper.Fail();
                    else if (op is Ldflda) /* implemented */ {}
                    else if (op is Ldind) throw AssertionHelper.Fail();
                    else if (op is Ldftn) throw AssertionHelper.Fail();
                    else if (op is Stloc) throw AssertionHelper.Fail();
                    else if (op is Starg) throw AssertionHelper.Fail();
                    else if (op is Stelem) throw AssertionHelper.Fail();
                    else if (op is Stfld) throw AssertionHelper.Fail();
                    else if (op is Stind) throw AssertionHelper.Fail();
                    // ops that neither read nor write from anywhere except stack
                    // can be freely skipped so we have to consider only a dozen of ops
                    else continue;

                    if (op is Ldloc || op is Ldloca)
                    {
                        var ldloc = op as Ldloc;
                        var ldloca = op as Ldloca;
                        var loc_il = ldloc != null ? ldloc.Loc :
                            ldloca != null ? ldloca.Loc : ((Func<ILocalVar>)(() => { throw AssertionHelper.Fail(); }))();

                        var violations = violatedDeps[op];
                        if (violations.OfType<Stloc>().Any(stloc => stloc.Index == loc_il.Index))
                        {
                            var loc_sym = _symbols.ResolveLocal(loc_il.Index);
                            var expr_ldloc = _mapOp(op).AssertCast<Ref>();
                            (expr_ldloc.Sym == loc_sym).AssertTrue();

                            var locName = loc_il.Source.DebugInfo == null ? ("loc" + loc_il.Index) :
                                !loc_il.Source.DebugInfo.LocalNames.ContainsKey(loc_il.Index) ? ("loc" + loc_il.Index) :
                                loc_il.Source.DebugInfo.LocalNames[loc_il.Index];
                            var bufLocName = Seq.Nats.Select(i => locName + "__CF$" + i.ToString("0000")).First(name1 => _symbols.Locals.None(loc1 => loc1.Name == name1));
                            var bufLoc = _symbols.IntroduceLocal(bufLocName, loc_il.Type);

                            var startOfViolations = q_evalOrders.Keys.First(q => Set.Intersect(q_evalOrders[q], violations).IsNotEmpty());
                            q_evalOrders[startOfViolations].Except(violations).AssertEmpty();
                            var insertionPoint = fixt.IndexOf(startOfViolations);
                            fixt.Insert(insertionPoint, new Assign(new Ref(bufLoc), new Ref(loc_sym)));
                            expr_ldloc.Parent.Children.ReplaceElements(expr_ldloc, new Ref(bufLoc));
                        }
                    }

                    if (op is Ldarg || op is Ldarga)
                    {
                        var ldarg = op as Ldarg;
                        var ldarga = op as Ldarga;
                        var arg_il = ldarg != null ? ldarg.Arg :
                            ldarga != null ? ldarga.Arg : ((Func<ParameterInfo>)(() => { throw AssertionHelper.Fail(); }))();
                        var arg_index = ldarg != null ? ldarg.Index :
                            ldarga != null ? ldarga.Index : ((Func<int>)(() => { throw AssertionHelper.Fail(); }))();

                        var violations = violatedDeps[op];
                        if (violations.OfType<Starg>().Any(starg => starg.Index == arg_index))
                        {
                            var arg_sym = _symbols.ResolveParam(arg_index);
                            var expr_ldarg = _mapOp(op).AssertCast<Ref>();
                            (expr_ldarg.Sym == arg_sym).AssertTrue();

                            var argName = arg_sym.Name;
                            var bufLocName = Seq.Nats.Select(i => argName + "__CF$" + i.ToString("0000")).First(name1 => _symbols.Locals.None(loc => loc.Name == name1));
                            var bufLoc = _symbols.IntroduceLocal(bufLocName, null);

                            var startOfViolations = q_evalOrders.Keys.First(q => Set.Intersect(q_evalOrders[q], violations).IsNotEmpty());
                            q_evalOrders[startOfViolations].Except(violations).AssertEmpty();
                            var insertionPoint = fixt.IndexOf(startOfViolations);
//.........这里部分代码省略.........
开发者ID:xeno-by,项目名称:truesight-lite,代码行数:101,代码来源:InitialDecompilation.cs


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