本文整理匯總了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;
}
}
}