本文整理汇总了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();
}
示例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();
}
}
示例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);
//
//.........这里部分代码省略.........
示例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);
}
示例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;
}