本文整理汇总了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();
}
}
示例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]();
}
}
示例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)]();
}
}
示例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]();
}
}
示例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);
}
示例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()));
}
}
示例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;
}
示例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
}
示例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();
}
示例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;
}
示例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;
}
}
示例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();
}
示例13: Require
public static void Require(IList<string> errors, string fieldValue, string error)
{
if (String.IsNullOrEmpty(fieldValue))
{
errors.Add(error);
}
}
示例14: GetHeightFromChildren
private double GetHeightFromChildren(IList<ICanvasItem> children)
{
children.SwapCoordinates();
var maxBottom = GetMaxRightFromChildren(children);
children.SwapCoordinates();
return maxBottom - Top;
}
示例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);
}