本文整理匯總了C#中ProtoCore.DSASM.StackValue.Select方法的典型用法代碼示例。如果您正苦於以下問題:C# StackValue.Select方法的具體用法?C# StackValue.Select怎麽用?C# StackValue.Select使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ProtoCore.DSASM.StackValue
的用法示例。
在下文中一共展示了StackValue.Select方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: GetValueFromIndices
/// <summary>
/// = array[index1][index2][...][indexN], and
/// indices = {index1, index2, ..., indexN}
/// </summary>
/// <param name="array"></param>
/// <param name="indices"></param>
/// <param name="core"></param>
/// <returns></returns>
public static StackValue GetValueFromIndices(StackValue array, List<StackValue> indices, RuntimeCore runtimeCore)
{
if (indices.Count == 0)
{
return array;
}
else if (!array.IsArray && !array.IsString)
{
runtimeCore.RuntimeStatus.LogWarning(WarningID.kOverIndexing, Resources.kArrayOverIndexed);
return StackValue.Null;
}
StackValue[][] zippedIndices = ArrayUtils.GetZippedIndices(indices, runtimeCore);
if (zippedIndices == null || zippedIndices.Length == 0)
{
return StackValue.Null;
}
StackValue[] values = new StackValue[zippedIndices.Length];
for (int i = 0; i < zippedIndices.Length; ++i)
{
values[i] = GetValueFromIndices(array, zippedIndices[i], runtimeCore);
}
if (zippedIndices.Length > 1)
{
if (array.IsString)
{
string result = string.Join(string.Empty, values.Select(v => runtimeCore.RuntimeMemory.Heap.GetString(v)));
return runtimeCore.RuntimeMemory.Heap.AllocateString(result);
}
else
{
return runtimeCore.RuntimeMemory.Heap.AllocateArray(values, null);
}
}
else
{
return values[0];
}
}