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


C# ImmutableArray.Skip方法代码示例

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


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

示例1: GetSigFromScriptSig

 private static ImmutableArray<byte> GetSigFromScriptSig(ImmutableArray<byte> scriptSig)
 {
     Debug.Assert(scriptSig[0] >= (int)ScriptOp.OP_PUSHBYTES1 && scriptSig[0] <= (int)ScriptOp.OP_PUSHBYTES75);
     // The first byte of scriptSig will be OP_PUSHBYTES, so the first byte indicates how many bytes to take to get sig from scriptSig
     return scriptSig.Skip(1).Take(scriptSig[0]).ToImmutableArray();
 }
开发者ID:holinov,项目名称:BitSharp,代码行数:6,代码来源:ScriptEngineTest.cs

示例2: GetPubKeyFromScripts

 private static ImmutableArray<byte> GetPubKeyFromScripts(ImmutableArray<byte> scriptSig, ImmutableArray<byte> pubKey)
 {
     if (scriptSig.Length > scriptSig[0] + 1)
     {
         var result = scriptSig.Skip(1 + scriptSig[0] + 1).Take(scriptSig.Skip(1 + scriptSig[0]).First()).ToImmutableArray();
         return result;
     }
     else
     {
         return pubKey.Skip(1).Take(pubKey.Length - 2).ToImmutableArray();
     }
 }
开发者ID:holinov,项目名称:BitSharp,代码行数:12,代码来源:ScriptEngineTest.cs

示例3: EmitCall

        internal TypeSymbol EmitCall(ILOpCode code, MethodSymbol method, BoundExpression thisExpr, ImmutableArray<BoundExpression> arguments)
        {
            Contract.ThrowIfNull(method);

            TypeSymbol thisType;

            // <this>
            if (thisExpr != null)
            {
                thisType = Emit(thisExpr);
                Debug.Assert(thisType != null && thisType.SpecialType != SpecialType.System_Void);

                if (method.HasThis)
                {
                    if (thisType.IsValueType)
                    {
                        EmitStructAddr(thisType);   // value -> valueref
                    }
                }
                else
                {
                    EmitPop(thisType);
                    thisType = null;
                }
            }
            else
            {
                if (method.HasThis && code != ILOpCode.Newobj)
                {
                    if (ThisPlaceOpt != null && ThisPlaceOpt.TypeOpt != null &&
                        ThisPlaceOpt.TypeOpt.IsEqualToOrDerivedFrom(method.ContainingType))
                    {
                        // implicit $this instance
                        thisType = EmitThis();
                        code = ILOpCode.Call;   // instead of .callvirt
                    }
                    else
                    {
                        throw new ArgumentException();  // TODO: PHP would create temporary instance of class
                    }
                }

                thisType = null;
            }

            // arguments
            var parameters = method.Parameters;
            int arg_index = 0;      // next argument to be emitted from <arguments>
            var param_index = 0;    // loaded parameters
            var writebacks = new List<WriteBackInfo>();

            for (; param_index < parameters.Length; param_index++)
            {
                var p = parameters[param_index];

                // special implicit parameters
                if (arg_index == 0 && p.IsImplicitlyDeclared)
                {
                    // <ctx>
                    if (SpecialParameterSymbol.IsContextParameter(p))
                    {
                        EmitLoadContext();
                        continue;
                    }
                    // TypeCtx, Locals, ...
                    throw new NotImplementedException();
                }

                // load arguments
                if (p.IsParams)
                {
                    Debug.Assert(p.Type.IsArray());

                    // wrap remaining arguments to array
                    var values = (arg_index < arguments.Length) ? arguments.Skip(arg_index).ToArray() : new BoundExpression[0];
                    arg_index += values.Length;
                    Emit_NewArray(((ArrayTypeSymbol)p.Type).ElementType, values);
                    break;  // p is last one
                }

                if (arg_index < arguments.Length)
                {
                    EmitLoadArgument(p, arguments[arg_index++], writebacks);
                }
                else
                {
                    EmitParameterDefaultValue(p);
                }
            }

            // emit remaining not used arguments
            for (; arg_index < arguments.Length; arg_index++)
            {
                EmitPop(Emit(arguments[arg_index]));
            }

            // call the method
            var result = EmitCall(code, method);

            //
//.........这里部分代码省略.........
开发者ID:iolevel,项目名称:peachpie,代码行数:101,代码来源:CodeGenerator.Emit.cs

示例4: CreateSymbolCompletionGroup

        private static CompletionItem CreateSymbolCompletionGroup(string name, ImmutableArray<Symbol> symbols)
        {
            var multiple = symbols.Skip(1).Any();
            if (!multiple)
                return CreateSymbolCompletion(symbols.First());

            var hasNonInvocables = symbols.Any(s => !(s is InvocableSymbol));
            if (!hasNonInvocables)
                return CreateInvocableCompletionGroup(symbols);

            var displayText = name;
            var insertionText = name;

            var sb = new StringBuilder();
            sb.Append(Resources.AmbiguousName);
            foreach (var symbol in symbols)
            {
                sb.AppendLine();
                sb.Append(@"  ");
                sb.Append(symbol);
            }

            var description = sb.ToString();
            return new CompletionItem(displayText, insertionText, description, Glyph.CompletionWarning);
        }
开发者ID:Samana,项目名称:HlslTools,代码行数:25,代码来源:SymbolCompletionProvider.cs

示例5: GetFigureFromPoints

        private static PathFigure GetFigureFromPoints(ImmutableArray<PortablePoint> points)
        {
            var figure = new PathFigure();

            figure.StartPoint = points.First().ToPoint();

            foreach (var segment in points.Skip(1).Select(p => new LineSegment() { Point = p.ToPoint() }))
            {
                figure.Segments.Add(segment);
            }
            return figure;
        }
开发者ID:imanushin,项目名称:ColorsMagic,代码行数:12,代码来源:GameView.xaml.cs


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