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


C# IList类代码示例

本文整理汇总了C#中IList的典型用法代码示例。如果您正苦于以下问题:C# IList类的具体用法?C# IList怎么用?C# IList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: AssignBatchActionResultsAsync

        public async Task AssignBatchActionResultsAsync(IODataClient client,
            ODataResponse batchResponse, IList<Func<IODataClient, Task>> actions, IList<int> responseIndexes)
        {
            var exceptions = new List<Exception>();
            for (var actionIndex = 0; actionIndex < actions.Count && !exceptions.Any(); actionIndex++)
            {
                var responseIndex = responseIndexes[actionIndex];
                if (responseIndex >= 0 && responseIndex < batchResponse.Batch.Count)
                {
                    var actionResponse = batchResponse.Batch[responseIndex];
                    if (actionResponse.Exception != null)
                    {
                        exceptions.Add(actionResponse.Exception);
                    }
                    else if (actionResponse.StatusCode >= (int)HttpStatusCode.BadRequest)
                    {
                        exceptions.Add(WebRequestException.CreateFromStatusCode((HttpStatusCode)actionResponse.StatusCode));
                    }
                    else
                    {
                        await actions[actionIndex](new ODataClient(client as ODataClient, actionResponse));
                    }
                }
            }

            if (exceptions.Any())
            {
                throw exceptions.First();
            }
        }
开发者ID:ErikWitkowski,项目名称:Simple.OData.Client,代码行数:30,代码来源:ResponseReaderBase.cs

示例2: Execute

        public void Execute(IList<Action> operations, Action<IEnumerable<Action>> remaining)
        {
            for (int i = 0; i < operations.Count; i++)
            {
                if (_stopping)
                    break;

                operations[i]();
            }
        }
开发者ID:Nangal,项目名称:Stact,代码行数:10,代码来源:BasicOperationExecutor.cs

示例3: DoChaos

 public static void DoChaos(Func<bool> doInjectFault, IList<Action> faults)
 {
     if (faults!=null
     && faults.Count>0
     && doInjectFault()
     )
      {
     Trace.WriteLine("CHAOSMONKEY STRIKES AGAIN!!!!");
     faults[_rnd.Next(faults.Count)]();
      }
 }
开发者ID:zybermark,项目名称:ChaosDotNet,代码行数:11,代码来源:ChaosHelper.cs

示例4: Execute

        public virtual void Execute(IList<Action> ops, Action<IEnumerable<Action>> remainingOps)
        {
            for (var i = 0; i < ops.Count; i++)
            {
                if (!AcceptingJobs)
                {
                    remainingOps.NotNull(obj => remainingOps(ops.Skip(i + 1)));
                    break;
                }

                ops[i]();
            }
        }
开发者ID:helios-io,项目名称:helios,代码行数:13,代码来源:BasicExecutor.cs

示例5: EmitArray

        /// <summary>
        ///   Emits an array.
        /// </summary>
        /// <param name="generator"> The generator. </param>
        /// <param name="arrayType"> Type of the array. </param>
        /// <param name="emitElements"> The emit elements. </param>
        public static void EmitArray(this ILGenerator generator, Type arrayType, IList<Action<ILGenerator>> emitElements)
        {
            var tLocal = generator.DeclareLocal(arrayType.MakeArrayType());
            generator.Emit(OpCodes.Ldc_I4, emitElements.Count);
            generator.Emit(OpCodes.Newarr, arrayType);
            generator.EmitStoreLocation(tLocal.LocalIndex);

            for (var i = 0; i < emitElements.Count; i++) {
                generator.EmitLoadLocation(tLocal.LocalIndex);
                generator.Emit(OpCodes.Ldc_I4, i);
                emitElements[i](generator);
                generator.Emit(OpCodes.Stelem_Ref);
            }
            generator.EmitLoadLocation(tLocal.LocalIndex);
        }
开发者ID:virmitio,项目名称:coapp,代码行数:21,代码来源:EmitExtensions.cs

示例6: CheckIfReturnsSpecifiedType

 private static void CheckIfReturnsSpecifiedType(ExpressionNode expression, IList<Error> errors, TigerType type)
 {
     if (!(expression.ReturnType == type)) {
         errors.Add(new UnexpectedTypeError(expression.Line, expression.Column, expression.ReturnType,
                                            IntegerType.Create()));
     }
 }
开发者ID:omederos,项目名称:TigerNET,代码行数:7,代码来源:ErrorsHelper.cs

示例7: DiscoverQueryReferences

 public static IList<QueryReference> DiscoverQueryReferences(this SqlExpression expression, ref int level, IList<QueryReference> list)
 {
     var visitor = new QueryReferencesVisitor(list, level);
     visitor.Visit(expression);
     level = visitor.Level;
     return visitor.References;
 }
开发者ID:deveel,项目名称:deveeldb,代码行数:7,代码来源:QueryExpressionExtensions.cs

示例8: foreach

        /// <summary>
        /// Replaces the intrinsic call site
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="typeSystem">The type system.</param>
        void IIntrinsicPlatformMethod.ReplaceIntrinsicCall(Context context, ITypeSystem typeSystem, IList<RuntimeParameter> parameters)
        {
            var result = context.Result;
            var op1 = context.Operand1;
            var op2 = context.Operand2;
            var constant = Operand.CreateConstant(BuiltInSigType.IntPtr, parameters.Count * 4);

            var eax = Operand.CreateCPURegister(BuiltInSigType.IntPtr, GeneralPurposeRegister.EAX); // FIXME - need access to virtual register allocator
            var edx = Operand.CreateCPURegister(BuiltInSigType.IntPtr, GeneralPurposeRegister.EDX); // FIXME - need access to virtual register allocator
            var esp = Operand.CreateCPURegister(BuiltInSigType.IntPtr, GeneralPurposeRegister.ESP); // FIXME - need access to virtual register allocator
            var ebp = Operand.CreateCPURegister(BuiltInSigType.IntPtr, GeneralPurposeRegister.EBP); // FIXME - need access to virtual register allocator
            context.SetInstruction(X86.Sub, esp, constant);
            context.AppendInstruction(X86.Mov, edx, esp);

            var size = parameters.Count * 4 + 4;
            foreach (var parameter in parameters)
            {
                context.AppendInstruction(X86.Mov, Operand.CreateMemoryAddress(BuiltInSigType.IntPtr, edx, new IntPtr(size - 4)), Operand.CreateMemoryAddress(BuiltInSigType.IntPtr, ebp, new IntPtr(size + 4)));
                size -= 4;
            }
            context.AppendInstruction(X86.Mov, Operand.CreateMemoryAddress(BuiltInSigType.IntPtr, edx, new IntPtr(size - 4)), op1);

            context.AppendInstruction(X86.Mov, eax, op2);
            context.AppendInstruction(X86.Call, null, eax);
            context.AppendInstruction(X86.Add, esp, constant);
            context.AppendInstruction(X86.Mov, result, Operand.CreateCPURegister(result.Type, GeneralPurposeRegister.EAX)); // FIXME - need access to virtual register allocator
        }
开发者ID:Zahovay,项目名称:MOSA-Project,代码行数:32,代码来源:InvokeInstanceDelegateWithReturn.cs

示例9: GetLocationSelectedListItem

 public static void GetLocationSelectedListItem(IList<Location> locations, out MultiSelectList allLocation, out List<SelectListItem> selectListItems)
 {
     var multiSelectList = new MultiSelectList(locations, "LocationId", "Province", locations);
     allLocation = multiSelectList;
     selectListItems =
         locations.Select(o => new SelectListItem { Text = o.Province, Value = o.Province }).ToList();
 }
开发者ID:jzinedine,项目名称:Cedar,代码行数:7,代码来源:ControllerHelper.cs

示例10: BuildTree

 /// <summary>
 /// Recursive menu builder
 /// </summary>
 /// <param name="flatList">Original flat menu items list</param>
 /// <param name="parentId">Parent node ID</param>
 /// <returns>Hierarchical list</returns>
 private IList<SiteMapItem> BuildTree(IList<SiteMapItem> flatList, int parentId)
 {
     var list = new List<SiteMapItem>();
     EnumerableExtensions.ForEach(flatList.Where(x => x.ParentId == parentId), list.Add);
     list.ForEach(x => x.Children = BuildTree(flatList, x.Id));
     return list;
 }
开发者ID:HRINY,项目名称:HRI-Umbraco,代码行数:13,代码来源:SiteMapService.cs

示例11: Compiler

        public ICLS_Expression Compiler(IList<Token> tlist, ICLS_Environment content)
        {
            ICLS_Expression value;

            int expbegin = 0;
            int expend = FindCodeBlock(tlist, expbegin);
            if (expend != tlist.Count - 1)
            {
                LogError(tlist, "CodeBlock 识别问题,异常结尾", expbegin, expend);
                return null;
            }
            bool succ = Compiler_Expression_Block(tlist, content, expbegin, expend, out value);
            if (succ)
            {
                if (value == null)
                {
                    logger.Log_Warn("编译为null:");
                }
                return value;

            }
            else
            {
                LogError(tlist, "编译失败:", expbegin, expend);
                return null;
            }



        }
开发者ID:GraphicGame,项目名称:CSLightStudio,代码行数:30,代码来源:CLS_Compiler.cs

示例12: SetCurrent

        public void SetCurrent(UiEncodingWindowSource source, IList<int> mainIndices, IList<int> additionalIndices)
        {
            CurrentSource = source;
            CurrentMainIndices = mainIndices;
            CurrentAdditionalIndices = additionalIndices;

            for (int i = mainIndices.Count; i < _mainControls.Count; i++)
                _mainControls[i].Visibility = Visibility.Collapsed;
            for (int i = additionalIndices.Count; i < _additionalControls.Count; i++)
                _additionalControls[i].Visibility = Visibility.Collapsed;

            if (CurrentSource == null)
                return;

            for (int i = 0; i < mainIndices.Count; i++)
            {
                _mainControls[i].Load(source, mainIndices[i]);
                _mainControls[i].Visibility = Visibility.Visible;
            }

            for (int i = 0; i < additionalIndices.Count; i++)
            {
                _additionalControls[i].Load(source, additionalIndices[i]);
                _additionalControls[i].Visibility = Visibility.Visible;
            }

            _drawEvent.NullSafeSet();
        }
开发者ID:truongan012,项目名称:Pulse,代码行数:28,代码来源:UiEncodingCharactersControl.cs

示例13: Require

 public static void Require(IList<string> errors, string fieldValue, string error)
 {
     if (String.IsNullOrEmpty(fieldValue))
     {
         errors.Add(error);
     }
 }
开发者ID:jean-christophe-moinet,项目名称:jcmoinet-test-web,代码行数:7,代码来源:AccountHelpers.cs

示例14: GetHeightFromChildren

 private double GetHeightFromChildren(IList<ICanvasItem> children)
 {
     children.SwapCoordinates();
     var maxBottom = GetMaxRightFromChildren(children);
     children.SwapCoordinates();
     return maxBottom - Top;
 }
开发者ID:modulexcite,项目名称:VisualDesigner,代码行数:7,代码来源:ChildrenExpandableCanvasItem.cs

示例15: TranslateInput

        private void TranslateInput(string input)
        {
            var indexOfFirstSeparator = input.IndexOf(SplitCommandSymbol);

            this.Name = input.Substring(0, indexOfFirstSeparator);
            this.Parameters = input.Substring(indexOfFirstSeparator + 1).Split(new[] { SplitCommandSymbol }, StringSplitOptions.RemoveEmptyEntries);
        }
开发者ID:damy90,项目名称:Telerik-all,代码行数:7,代码来源:Command.cs


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