本文整理汇总了C#中PValue.All方法的典型用法代码示例。如果您正苦于以下问题:C# PValue.All方法的具体用法?C# PValue.All怎么用?C# PValue.All使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PValue
的用法示例。
在下文中一共展示了PValue.All方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _combineArguments
private void _combineArguments(PValue[] args, out PValue[] nonArguments,
out PValue[] effectiveArguments)
{
System.Diagnostics.Debug.Assert(args.All(value => value != null),
"Actual (CLI) null references passed to " +
GetType().Name + ".IndirectCall");
var argc = args.Length;
var countExcessArguments = System.Math.Max(
argc - _computeCountOpenArgumentsMapped(argc), 0);
var nonArgumentPrefix = NonArgumentPrefix;
var mappingLength = _mappings.Count;
var countEffectiveArguments =
System.Math.Max(mappingLength + countExcessArguments - nonArgumentPrefix, 0);
nonArguments = new PValue[nonArgumentPrefix];
effectiveArguments = new PValue[countEffectiveArguments];
System.Diagnostics.Debug.Assert(effectiveArguments.Length + nonArgumentPrefix >=
mappingLength);
//Apply mapping
var openArgumentUsed = new bool[argc];
var absoluteIndex = 0;
for (; absoluteIndex < mappingLength; absoluteIndex++)
{
var mapping = _mappings.Array[_mappings.Offset + absoluteIndex];
System.Diagnostics.Debug.Assert(mapping != 0, "Mapping contains zero");
int relativeIndex;
var argumentList = _determineArgumentList(
out relativeIndex, nonArgumentPrefix, absoluteIndex, nonArguments,
effectiveArguments);
if (0 <= mapping)
{
var index = mapping - 1;
//maps closed arguments
argumentList[relativeIndex] = _closedArguments[index];
}
else
{
var index = (-mapping) - 1;
//maps open argument
if (index < argc)
{
argumentList[relativeIndex] = args[index];
openArgumentUsed[index] = true;
}
else
{
argumentList[relativeIndex] = PType.Null;
}
}
}
//Add excess arguments
for (var i = 0; i < openArgumentUsed.Length; i++)
{
if (openArgumentUsed[i])
continue;
int relativeIndex;
var argumentList = _determineArgumentList(out relativeIndex, nonArgumentPrefix,
absoluteIndex++, nonArguments,
effectiveArguments);
argumentList[relativeIndex] = args[i];
}
System.Diagnostics.Debug.Assert(nonArguments.All(x => !ReferenceEquals(x, null)),
"non-argument left unassigned");
System.Diagnostics.Debug.Assert(effectiveArguments.All(x => !ReferenceEquals(x, null)),
"effective argument left unassigned");
}