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


C# List.Add方法代码示例

本文整理汇总了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));
                }
            }
开发者ID:rchandrashekara,项目名称:main,代码行数:17,代码来源:_ast.cs

示例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
 }
开发者ID:rchandrashekara,项目名称:main,代码行数:9,代码来源:_ast.cs

示例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));
 }
开发者ID:rchandrashekara,项目名称:main,代码行数:8,代码来源:_ast.cs

示例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);
            }
开发者ID:rchandrashekara,项目名称:main,代码行数:8,代码来源:_ast.cs

示例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;
            }
开发者ID:rchandrashekara,项目名称:main,代码行数:8,代码来源:_ast.cs

示例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;
            }
开发者ID:rchandrashekara,项目名称:main,代码行数:17,代码来源:_ast.cs

示例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;
            }
开发者ID:rchandrashekara,项目名称:main,代码行数:11,代码来源:_ast.cs

示例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);
            }
开发者ID:rchandrashekara,项目名称:main,代码行数:10,代码来源:_ast.cs

示例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));
     }
 }
开发者ID:rchandrashekara,项目名称:main,代码行数:9,代码来源:_ast.cs

示例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);
            }
开发者ID:rchandrashekara,项目名称:main,代码行数:13,代码来源:_ast.cs

示例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));
 }
开发者ID:rchandrashekara,项目名称:main,代码行数:6,代码来源:_ast.cs

示例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;
            }
开发者ID:BCSharp,项目名称:ironpython3,代码行数:23,代码来源:_ast.cs

示例13: Set

 internal Set(SetExpression setExpression)
     : this() {
     _elts = new PythonList(setExpression.Items.Count);
     foreach (AstExpression item in setExpression.Items) {
         _elts.Add(Convert(item));
     }
 }
开发者ID:BCSharp,项目名称:ironpython3,代码行数:7,代码来源:_ast.cs

示例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));
 }
开发者ID:BCSharp,项目名称:ironpython3,代码行数:15,代码来源:_ast.cs

示例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);
 }
开发者ID:BCSharp,项目名称:ironpython3,代码行数:14,代码来源:_ast.cs


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