當前位置: 首頁>>代碼示例>>C#>>正文


C# Buffer.Get方法代碼示例

本文整理匯總了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;
        }
開發者ID:JoinPatterns,項目名稱:ScalableJoins,代碼行數:13,代碼來源:Lift.cs

示例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;
     }
       }
 }
開發者ID:JoinPatterns,項目名稱:ScalableJoins,代碼行數:35,代碼來源:Lift.cs


注:本文中的System.Buffer.Get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。