本文整理汇总了C#中ImmutableStack.Count方法的典型用法代码示例。如果您正苦于以下问题:C# ImmutableStack.Count方法的具体用法?C# ImmutableStack.Count怎么用?C# ImmutableStack.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImmutableStack
的用法示例。
在下文中一共展示了ImmutableStack.Count方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RecEnumerateOutcomes
RecEnumerateOutcomes(
ImmutableStack<Func<DiscriminatedUnionCaseParameter, DestructureMethodParameter>> results,
Func<DiscriminatedUnionCaseParameter, DestructureMethodParameter>[] resultTypes,
int numIterations)
{
if (results.Count() >= numIterations)
{
yield return results;
}
else
{
foreach (var resultType in resultTypes)
{
foreach (var a in RecEnumerateOutcomes(results.Push(resultType), resultTypes, numIterations))
{
yield return a;
}
}
}
}
示例2: WriteToMemoryStream
/// <summary>
/// Writes zscii text to a memory stream.
/// </summary>
/// <param name="zsciiText">
/// The zscii text.
/// </param>
protected virtual void WriteToMemoryStream(ImmutableStack<Zscii> zsciiText)
{
if (this.memoryStreams != null)
{
var memoryStream = this.memoryStreams.Top;
this.WriteZsciiToMemory(memoryStream.Table + memoryStream.CharacterCount + 2, zsciiText);
memoryStream.CharacterCount += zsciiText.Count();
}
}
示例3: CallRoutine
/// <summary>
/// Calls a routine.
/// </summary>
/// <param name="routineType">
/// The routine type.
/// </param>
/// <param name="packedAddress">
/// The packed address of the routine.
/// </param>
/// <param name="arguments">
/// Routine arguments.
/// </param>
protected void CallRoutine(RoutineType routineType, ushort packedAddress, ImmutableStack<ushort> arguments)
{
if (packedAddress == 0)
{
this.Return(0, routineType);
return;
}
var argumentCount = (byte)arguments.Count();
var programCounter = this.UnpackRoutineAddress(packedAddress);
var localVariableCount = this.Memory.ReadByte(programCounter);
if (localVariableCount > MaximumLocalVariables)
{
this.FrontEnd.ErrorNotification(ErrorCondition.InvalidRoutine, "Called a routine at address " + programCounter + " with " + localVariableCount + " local variables.");
}
this.CallStack.BeginRoutine(routineType, programCounter + 1, argumentCount, localVariableCount);
this.InitializeLocalVariables(localVariableCount);
byte localVariableNumber = 0;
foreach (var argument in arguments.Enumerable())
{
if (localVariableNumber >= localVariableCount)
{
break;
}
this.CallStack.WriteLocalVariable(localVariableNumber++, argument);
}
}
示例4: ZCharactersToZscii
/// <summary>
/// Converts z-characters to zscii text.
/// </summary>
/// <param name="calledRecursively">
/// A value which indicates whether the method was called recursively.
/// </param>
/// <param name="zcharacter">
/// The zcharacter.
/// </param>
/// <param name="currentAlphabet">
/// The current alphabet.
/// </param>
/// <param name="nextAlphabet">
/// The next alphabet.
/// </param>
/// <param name="lockedAlphabet">
/// The locked alphabet.
/// </param>
/// <param name="zcharacters">
/// The zcharacters.
/// </param>
/// <param name="zsciiText">
/// The zscii text.
/// </param>
protected virtual void ZCharactersToZscii(bool calledRecursively, byte zcharacter, byte currentAlphabet, ref byte nextAlphabet, ref byte lockedAlphabet, ref ImmutableStack<byte> zcharacters, ref ImmutableStack<Zscii> zsciiText)
{
switch (zcharacter)
{
case 0:
zsciiText = zsciiText.Add(Zscii.Space);
break;
case 1:
zsciiText = zsciiText.Add(Zscii.NewLine);
break;
case 2:
case 3:
nextAlphabet = (byte)((lockedAlphabet + zcharacter - 1) % 3);
break;
case 4:
case 5:
nextAlphabet = lockedAlphabet = (byte)((lockedAlphabet + zcharacter) % 3);
break;
default:
if (zcharacter == 6 && currentAlphabet == 2)
{
if (zcharacters.Count() > 1)
{
zsciiText = zsciiText.Add((Zscii)((zcharacters.Top * 32) + zcharacters.Tail.Top));
zcharacters = zcharacters.Tail.Tail;
}
else
{
zcharacters = null;
}
break;
}
zsciiText = zsciiText.Add(this.GetZsciiAlphabetCharacter((byte)((currentAlphabet * 26) + zcharacter - 6)));
break;
}
}