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


C# Vector.AddRange方法代码示例

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


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

示例1: ReadVectorHandler2

 public static object ReadVectorHandler2(LispReader stream, string ch, int arg)
 {
     if (stream.ReadChar() != '(')
     {
         throw stream.MakeScannerException("Invalid #() expression");
     }
     var list = stream.ReadDelimitedList(")");
     var obj = new Vector();
     obj.AddRange(list);
     if (arg == -1)
     {
         // default no action
     }
     else if (arg < obj.Count)
     {
         throw new LispException("Vector {0} contains more than {1} items", ToPrintString(obj), arg);
     }
     else if (arg > obj.Count)
     {
         var filler = obj.Count == 0 ? (object)null : obj[obj.Count - 1];
         while (obj.Count < arg)
         {
             obj.Add(filler);
         }
     }
     return obj;
 }
开发者ID:jantolenaar,项目名称:kiezellisp,代码行数:27,代码来源:reader-handlers.cs

示例2: ParseInterpolateString

        public static object ParseInterpolateString(string s)
        {
            var pos = 0;
            var code = new Vector();

            for (var match = InterpolationStringPatterns.Match(s, pos); match.Success; match = match.NextMatch())
            {
                var left = match.Index;
                var sideEffect = false;
                var script = "";

                if (left != pos)
                {
                    code.Add(s.Substring(pos, left - pos));
                }

                pos = match.Index + match.Length;

                if (match.Groups[1].Success)
                {
                    // <%...%> or <%=...%>
                    script = match.Groups[1].Value.Trim();
                    if (script.StartsWith("="))
                    {
                        script = script.Substring(1);
                        sideEffect = false;
                    }
                    else
                    {
                        sideEffect = true;
                    }
                }
                else if (match.Groups[2].Success)
                {
                    // <!...!> or <!=...!>
                    script = match.Groups[2].Value.Trim();
                    if (script.StartsWith("="))
                    {
                        script = script.Substring(1);
                        sideEffect = false;
                    }
                    else
                    {
                        sideEffect = true;
                    }
                }
                else if (match.Groups[3].Success)
                {
                    // ${...}
                    script = match.Groups[3].Value;
                    sideEffect = false;
                }

                script = script.Trim();

                if (script.Length > 0)
                {
                    if (sideEffect)
                    {
                        if (script[0] != '(')
                        {
                            // must have function call to have side effect
                            script = "(with-output-to-string ($stdout) (" + script + "))";
                        }
                        else
                        {
                            script = "(with-output-to-string ($stdout) " + script + ")";
                        }
                    }
                    var statements = ReadAllFromString(script);

                    if (statements.Count > 1)
                    {
                        code.Add(new Cons(Symbols.Do, AsList(statements)));
                    }
                    else
                    {
                        code.AddRange(statements);
                    }
                }
            }

            if (code.Count == 0)
            {
                return s;
            }
            else
            {
                if (pos < s.Length)
                {
                    code.Add(s.Substring(pos, s.Length - pos));
                }

                return new Cons(Symbols.Str, AsList(code));
            }
        }
开发者ID:jantolenaar,项目名称:kiezellisp,代码行数:96,代码来源:reader-handlers.cs

示例3: ReadVectorHandler

 public static object ReadVectorHandler(LispReader stream, char ch)
 {
     var list = stream.ReadDelimitedList("]");
     var obj = new Vector();
     obj.AddRange(list);
     return obj;
 }
开发者ID:jantolenaar,项目名称:kiezellisp,代码行数:7,代码来源:reader-handlers.cs


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