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


C# ICollection.Reverse方法代码示例

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


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

示例1: Insert

 public static int Insert(this Collection<Instruction> collection, int index, ICollection<Instruction> instructions)
 {
     foreach (var instruction in instructions.Reverse())
     {
         collection.Insert(index, instruction);
     }
     return index + instructions.Count();
 }
开发者ID:mdabbagh88,项目名称:NullGuard,代码行数:8,代码来源:InstructionListExtensions.cs

示例2: InsertAfterInstructions

 public static void InsertAfterInstructions(this ILProcessor il, Instruction target,
     ICollection<Instruction> instructions)
 {
     foreach (var instruction in instructions.Reverse())
     {
         il.InsertAfter(target, instruction);
     }
 }
开发者ID:MarinaAndreeva,项目名称:ncloak,代码行数:8,代码来源:ILProcessorExtensions.cs

示例3: TestDictionary

 void TestDictionary(ICollection<KeyValuePair<int, int>> data)
 {
     var sw = new Stopwatch();
     sw.Start();
     var dic = new Dictionary<int, int>(data.Count);
     foreach (var d in data)
         dic[d.Key] = d.Value;
     sw.Stop();
     var sw2 = new Stopwatch();
     sw2.Start();
     foreach (var d in data.Reverse())
         Assert.AreEqual(d.Value, dic[d.Key]);
     sw2.Stop();
     Console.WriteLine("Dictionary: creation=" + sw.Elapsed + ", search=" + sw2.Elapsed);
 }
开发者ID:supcry,项目名称:MotifSeeker,代码行数:15,代码来源:StaticDictionaryTest.cs

示例4: InsertAtMethodReturnPoint

    /// <summary>
    /// Inserts a set of instructions at a given <paramref name="exitPointInstructionIndex"/>, ensuring that all branches that previously
    /// pointed to the return statement now point to the new instructions.
    /// 
    /// It's important that this method is only called for RET instruction exit points, otherwise we'd also need to fix
    /// up ExceptionHandler delimiter points.
    /// </summary>
    public static void InsertAtMethodReturnPoint(this MethodBody methodBody, int exitPointInstructionIndex, ICollection<Instruction> instructions)
    {
        var exitPointInstruction = methodBody.Instructions[exitPointInstructionIndex];

        var targetUpdateActions = GetMethodReturnPointReferenceTargetUpdateActions(methodBody.Instructions, exitPointInstruction).ToList();

        foreach (var instruction in instructions.Reverse())
        {
            methodBody.Instructions.Insert(exitPointInstructionIndex, instruction);
        }

        var newTargetInstruction = instructions.First();
        foreach (var targetUpdateAction in targetUpdateActions)
        {
            targetUpdateAction(newTargetInstruction);
        }
    }
开发者ID:dpisanu,项目名称:NullGuard,代码行数:24,代码来源:InstructionListExtensions.cs

示例5: GetFirstMiddleware

        private static HandlerMiddleware GetFirstMiddleware(ICollection<KeyValuePair<object, object[]>> middlewareItems)
        {
            if (middlewareItems.Count == 0)
                return EmptyHandlerMiddleware.Instance;

            var middlewares = new List<HandlerMiddleware>();
            foreach (var item in middlewareItems.Reverse())
            {
                var lastMiddleware = middlewares.LastOrDefault() ?? EmptyHandlerMiddleware.Instance;

                IEnumerable<object> args = new object[] { lastMiddleware };
                if (item.Value != null && item.Value.Any())
                {
                    args = args.Concat(item.Value);
                }

                middlewares.Add(GetHandlerMiddleware(item.Key, args.ToArray()));
            }
            middlewares.Reverse();
            return middlewares.FirstOrDefault();
        }
开发者ID:coderen,项目名称:WeiXinSDK,代码行数:21,代码来源:WeiXinHandler.cs

示例6: InvokeActionResultFilters

        protected virtual ResultExecutedContext InvokeActionResultFilters(
            ControllerContext context, ICollection<IResultFilter> filters, ActionResult result)
        {
            Precondition.Require(context, () => Error.ArgumentNull("context"));
            Precondition.Require(result, () => Error.ArgumentNull("result"));
            Precondition.Require(filters, () => Error.ArgumentNull("filters"));

            ResultExecutionContext rec = new ResultExecutionContext(context, result);
            Func<ResultExecutedContext> continuation = () => {
                InvokeActionResult(context, result);
                return new ResultExecutedContext(context, rec.Result, null);
            };

            Func<ResultExecutedContext> thunk = filters.Reverse().Aggregate(continuation,
                (next, filter) => () => InvokeActionResultFilter(filter, rec, next));
            return thunk();
        }
开发者ID:radischevo,项目名称:Radischevo.Wahha,代码行数:17,代码来源:ActionExecutor.cs

示例7: InvokeActionFilters

        protected virtual ActionExecutedContext InvokeActionFilters(
            ControllerContext context, ActionDescriptor action, 
            ICollection<IActionFilter> filters)
        {
            Precondition.Require(context, () => Error.ArgumentNull("context"));
            Precondition.Require(action, () => Error.ArgumentNull("action"));
            Precondition.Require(filters, () => Error.ArgumentNull("filters"));
            
            ActionExecutionContext exc = new ActionExecutionContext(context, action);
            Func<ActionExecutedContext> continuation = () =>
                new ActionExecutedContext(exc, null) { 
					Result = InvokeActionMethod(context, action, context.Parameters) 
				};

            Func<ActionExecutedContext> thunk = filters.Reverse().Aggregate(continuation,
                (next, filter) => () => InvokeActionFilter(filter, exc, next));
            return thunk();
        }
开发者ID:radischevo,项目名称:Radischevo.Wahha,代码行数:18,代码来源:ActionExecutor.cs

示例8: Rollback

        protected virtual void Rollback(ICollection<NewPackageAction> executedActions, IExecutionContext context)
        {
            if (executedActions.Count > 0)
            {
                // Only print the rollback warning if we have something to rollback
                context.Log(MessageLevel.Warning, Strings.ActionExecutor_RollingBack);
            }

            foreach (var action in executedActions.Reverse())
            {
                IActionHandler handler;
                if (!_actionHandlers.TryGetValue(action.ActionType, out handler))
                {
                    NuGetTraceSources.ActionExecutor.Error(
                        "rollback/unhandledaction",
                        "[{0}] Skipping unknown action: {1}",
                        action.PackageIdentity,
                        action.ToString());
                }
                else
                {
                    NuGetTraceSources.ActionExecutor.Info(
                        "rollback/executing",
                        "[{0}] Executing action: {1}",
                        action.PackageIdentity,
                        action.ToString());
                    handler.Rollback(action, context);
                }
            }
        }
开发者ID:sistoimenov,项目名称:NuGet2,代码行数:30,代码来源:ActionExecutor.cs

示例9: BeginInvokeActionFilters

		protected virtual IAsyncResult BeginInvokeActionFilters(ControllerContext context,
			ActionDescriptor action, ICollection<IActionFilter> filters, IDictionary<string, object> parameters,
			AsyncCallback callback, object state)
		{
			Func<ActionExecutedContext> endContinuation = null;

			BeginInvokeDelegate beginDelegate = delegate(AsyncCallback asyncCallback, object asyncState) {
				ActionExecutionContext preContext = new ActionExecutionContext(context, action);
				IAsyncResult innerAsyncResult = null;

				Func<Func<ActionExecutedContext>> beginContinuation = () => {
					innerAsyncResult = BeginInvokeActionMethod(context, action, parameters, asyncCallback, asyncState);
					return () => new ActionExecutedContext(preContext, null) {
						Result = EndInvokeActionMethod(innerAsyncResult)
					};
				};
				Func<Func<ActionExecutedContext>> thunk = filters.Reverse().Aggregate(beginContinuation,
					(next, filter) => () => InvokeActionFilterAsynchronously(filter, preContext, next));
				endContinuation = thunk();

				if (innerAsyncResult != null)
				{
					return innerAsyncResult;
				}
				else
				{
					MvcAsyncResult newAsyncResult = new MvcAsyncResult(asyncState);
					newAsyncResult.MarkCompleted(true, asyncCallback);

					return newAsyncResult;
				}
			};
			EndInvokeDelegate<ActionExecutedContext> endDelegate = delegate(IAsyncResult asyncResult) {
				return endContinuation();
			};
			return AsyncResultWrapper.Begin(callback, state, beginDelegate, endDelegate, _invokeMethodFiltersTag);
		}
开发者ID:radischevo,项目名称:Radischevo.Wahha,代码行数:37,代码来源:AsyncActionExecutor.cs


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