本文整理汇总了C#中IronPython.Runtime.List.Add方法的典型用法代码示例。如果您正苦于以下问题:C# List.Add方法的具体用法?C# List.Add怎么用?C# List.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IronPython.Runtime.List
的用法示例。
在下文中一共展示了List.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Call
internal Call(CallExpression call)
: this() {
_args = PythonOps.MakeEmptyList(call.Args.Count);
_keywords = new PythonList();
_func = Convert(call.Target);
foreach (IronPython.Compiler.Ast.Arg arg in call.Args) {
if (arg.Name == null)
_args.Add(Convert(arg.Expression));
else if (arg.Name == "*")
_starargs = Convert(arg.Expression);
else if (arg.Name == "**")
_kwargs = Convert(arg.Expression);
else
_keywords.Add(new keyword(arg));
}
}
示例2: ClassDef
internal ClassDef(ClassDefinition def)
: this() {
_name = def.Name;
_bases = PythonOps.MakeEmptyList(def.Bases.Count);
foreach (Compiler.Ast.Expression expr in def.Bases)
_bases.Add(Convert(expr));
_body = ConvertStatements(def.Body);
_decorator_list = new PythonList(); // TODO Actually fill in the decorators here
}
示例3: comprehension
internal comprehension(ComprehensionFor listFor, ComprehensionIf[] listIfs)
: this() {
_target = Convert(listFor.Left, Store.Instance);
_iter = Convert(listFor.List);
_ifs = PythonOps.MakeEmptyList(listIfs.Length);
foreach (ComprehensionIf listIf in listIfs)
_ifs.Add(Convert(listIf.Test));
}
示例4: Assign
internal Assign(AssignmentStatement stmt)
: this() {
_targets = PythonOps.MakeEmptyList(stmt.Left.Count);
foreach (Compiler.Ast.Expression expr in stmt.Left)
_targets.Add(Convert(expr, Store.Instance));
_value = Convert(stmt.Right);
}
示例5: Tuple
internal Tuple(TupleExpression list, expr_context ctx)
: this() {
_elts = PythonOps.MakeEmptyList(list.Items.Count);
foreach (Compiler.Ast.Expression expr in list.Items)
_elts.Add(Convert(expr, ctx));
_ctx = ctx;
}
示例6: Convert
internal static PythonList Convert(ComprehensionIterator[] iters) {
PythonList comps = new PythonList();
int start = 1;
for (int i = 0; i < iters.Length; i++) {
if (i == 0 || iters[i] is ComprehensionIf)
if (i == iters.Length - 1)
i++;
else
continue;
ComprehensionIf[] ifs = new ComprehensionIf[i - start];
Array.Copy(iters, start, ifs, 0, ifs.Length);
comps.Add(new comprehension((ComprehensionFor)iters[start - 1], ifs));
start = i + 1;
}
return comps;
}
示例7: Print
internal Print(PrintStatement stmt)
: this() {
if (stmt.Destination != null)
_dest = Convert(stmt.Destination);
_values = PythonOps.MakeEmptyList(stmt.Expressions.Count);
foreach (Compiler.Ast.Expression expr in stmt.Expressions)
_values.Add(Convert(expr));
_nl = !stmt.TrailingComma;
}
示例8: TryExcept
internal TryExcept(TryStatement stmt)
: this() {
_body = ConvertStatements(stmt.Body);
_handlers = PythonOps.MakeEmptyList(stmt.Handlers.Count);
foreach (TryStatementHandler tryStmt in stmt.Handlers)
_handlers.Add(Convert(tryStmt));
_orelse = ConvertStatements(stmt.Else, true);
}
示例9: Dict
internal Dict(DictionaryExpression expr)
: this() {
_keys = PythonOps.MakeEmptyList(expr.Items.Count);
_values = PythonOps.MakeEmptyList(expr.Items.Count);
foreach (SliceExpression item in expr.Items) {
_keys.Add(Convert(item.SliceStart));
_values.Add(Convert(item.SliceStop));
}
}
示例10: FunctionDef
internal FunctionDef(FunctionDefinition def)
: this() {
_name = def.Name;
_args = new arguments(def.Parameters);
_body = ConvertStatements(def.Body);
if (def.Decorators != null) {
_decorators = PythonOps.MakeEmptyList(def.Decorators.Count);
foreach (Compiler.Ast.Expression expr in def.Decorators)
_decorators.Add(Convert(expr));
} else
_decorators = PythonOps.MakeEmptyList(0);
}
示例11: Delete
internal Delete(DelStatement stmt)
: this() {
_targets = PythonOps.MakeEmptyList(stmt.Expressions.Count);
foreach (Compiler.Ast.Expression expr in stmt.Expressions)
_targets.Add(Convert(expr, Del.Instance));
}
示例12: Convert
internal static PythonList Convert(ComprehensionIterator[] iters) {
Generic.List<ComprehensionFor> cfCollector =
new Generic.List<ComprehensionFor>();
Generic.List<Generic.List<ComprehensionIf>> cifCollector =
new Generic.List<Generic.List<ComprehensionIf>>();
Generic.List<ComprehensionIf> cif = null;
for (int i = 0; i < iters.Length; i++) {
if (iters[i] is ComprehensionFor) {
ComprehensionFor cf = (ComprehensionFor)iters[i];
cfCollector.Add(cf);
cif = new Generic.List<ComprehensionIf>();
cifCollector.Add(cif);
} else {
ComprehensionIf ci = (ComprehensionIf)iters[i];
cif.Add(ci);
}
}
PythonList comps = new PythonList();
for (int i = 0; i < cfCollector.Count; i++)
comps.Add(new comprehension(cfCollector[i], cifCollector[i].ToArray()));
return comps;
}
示例13: Set
internal Set(SetExpression setExpression)
: this() {
_elts = new PythonList(setExpression.Items.Count);
foreach (AstExpression item in setExpression.Items) {
_elts.Add(Convert(item));
}
}
示例14: Compare
internal Compare(BinaryExpression expr)
: this() {
_left = Convert(expr.Left);
_ops = PythonOps.MakeList();
_comparators = PythonOps.MakeList();
while (BinaryExpression.IsComparison(expr.Right)) {
BinaryExpression right = (BinaryExpression)expr.Right;
// start accumulating ops and comparators
_ops.Add(Convert(expr.Operator));
_comparators.Add(Convert(right.Left));
expr = right;
}
_ops.Add(Convert(expr.Operator));
_comparators.Add(Convert(expr.Right));
}
示例15: ClassDef
internal ClassDef(ClassDefinition def)
: this() {
_name = def.Name;
_bases = PythonOps.MakeEmptyList(def.Bases.Count);
foreach (AstExpression expr in def.Bases)
_bases.Add(Convert(expr));
_body = ConvertStatements(def.Body);
if (def.Decorators != null) {
_decorator_list = PythonOps.MakeEmptyList(def.Decorators.Count);
foreach (AstExpression expr in def.Decorators)
_decorator_list.Add(Convert(expr));
} else
_decorator_list = PythonOps.MakeEmptyList(0);
}