本文整理汇总了C#中System.Buffer.Get方法的典型用法代码示例。如果您正苦于以下问题:C# Buffer.Get方法的具体用法?C# Buffer.Get怎么用?C# Buffer.Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Buffer
的用法示例。
在下文中一共展示了Buffer.Get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WaitTimes
private List<Pair<Lift, WaitTime>> WaitTimes(Dir dir)
{
List<Pair<Lift, WaitTime>> wait = new List<Pair<Lift, WaitTime>>();
foreach (Lift lift in mLifts) {
Buffer<Pair<Time, Buffer<bool>>> b = new Buffer<Pair<Time, Buffer<bool>>>();
lift.HowLong(Helpers.pair(Helpers.pair(mNum, dir), b));
WaitTime waittime = b.Get();
wait.Add(Helpers.pair(lift, waittime));
}
return wait;
}
示例2: CabinLoop
private void CabinLoop()
{
Buffer<Action> b = new Buffer<Action>();
while (true) {
mLift.Arrived(Helpers.pair(mFloors[mFloor], b));
switch (b.Get()) {
case Action.Wait:
UnderViewLock(delegate { mState = CabinState.Waiting; });
break;
case Action.Stop:
mFloors[mFloor].Arrived(mLift);
UnderViewLock(delegate { mState = CabinState.Stopping; });
WaitForEndTransition();
break;
case Action.Up:
UnderViewLock(delegate {
nextY = (mFloor + 1) * Program.COLUMNHEIGHT;
mState = CabinState.GoingUp;
});
WaitForEndTransition();
mFloor++;
break;
case Action.Down:
UnderViewLock(delegate {
nextY = (mFloor - 1) * Program.COLUMNHEIGHT;
mState = CabinState.GoingDown;
});
WaitForEndTransition();
mFloor--;
break;
default: Debug.Assert(false);
break;
}
}
}