<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      Easy to check recursion


      Introduct
      (This article is translate version , original version written in chinese , you can see it at http://www.rzrgm.cn/xdesigner/archive/2006/08/02/465483.html )
        I bring out a easy to check recursion , just call an universal function .
        When we develop complex software , maybe handle recursion , for example , some code modify object1's data , then object2's data has been modified automatic . but when code modify object2's data , then object1's data has been modified automatic too , so there are a recursion , if this recursion is un-control , then system must throw out StackOverflowException . I think somebody must meet this thing .
        Against this recursion cycle , It is nature to define a flag variable and use this variable to check recursion . When system modify object1's data , before modify , check this flat , if this flat has been set , then cancel modify operation , else , set this flag , modify object1's data , after modify operation , clear this flag . In this way , you can check recursion and avoid recursion cycle .
        But in this way , you must define flag varible and maintains this flag , when system modify object's data and throw out exception , forget clear flag, then system can not modify object's data for ever.This is not expediently .
        At there , I bring out a method to resolve this proplem . In fact , we can use system callback stack to check resursion . In .net software , we can get current thread's call stack from  type System.Diagnostics.StackTrace . StackTract's FrameCount property means stack layer count , and GetFrame function returns StackFrame object which maintains single stack layer's information , we can enumerate all call stack and check recursion . So I write a universal function to check recursion as following


      /// <summary>
      /// Check the parent function has recursion
      /// </summary>
      /// <returns>If recursion return true , else return false </returns>
      public static bool CheckRecursion()
      {
          System.Diagnostics.StackTrace myTrace = new System.Diagnostics.StackTrace();
          // If stack layer count less 3 , recursion impossible.
          if (myTrace.FrameCount < 3)
              return false;
          System.IntPtr mh = myTrace.GetFrame(1).GetMethod().MethodHandle.Value;
          for (int iCount = 2; iCount < myTrace.FrameCount; iCount++)
          {
              System.Reflection.MethodBase m = myTrace.GetFrame(iCount).GetMethod();
              if (m.MethodHandle.Value == mh)
              {
                  return true;
              }
          }
          return false;
      }


        you can use this function anywhere , for example


      void SomeFunction()// some function can not recursion
      {
         if( CheckRecursion())
            return ;
         //........ some code
      }


        We can expend this function , for example , where an universal function to return how many times recursion.
        This function is easy to use , but I test that it is run slowly , so I suggest you can not use it continual . When you must check recursion continual , you have to define flag variable and check recursion fast .
        XDesigner Studio ( http://www.xdesigner.cn/default-eng.htm ) 2006-10-10

      posted on 2006-10-10 10:35  袁永福 電子病歷,醫療信息化  閱讀(531)  評論(0)    收藏  舉報

      導航

      主站蜘蛛池模板: 亚洲精品岛国片在线观看| 国产成人亚洲综合图区| 搡老熟女老女人一区二区| 国产精品一区二区久久精品| 亚洲香蕉网久久综合影视| 中文字幕久久波多野结衣av| 日韩一区二区三区三级| 视频一区二区三区自拍偷拍 | 亚洲大尺度无码无码专线| 国产精品毛片一区二区| 国产精品第二页在线播放| 毛茸茸性xxxx毛茸茸毛茸茸| 成人国产亚洲精品天堂av| 国产中文字幕精品在线| 免费人成网站免费看视频| 日韩中文日韩中文字幕亚| 亚洲成人av综合一区| 国产suv精品一区二区四| 中文字幕av中文字无码亚| 丰满的女邻居2| 国产口爆吞精在线视频2020版| 三级国产三级在线| 精品一区二区成人码动漫| 亚洲高清国产自产拍av| 少妇精品视频一码二码三| 久久综合亚洲色一区二区三区| 万源市| 国产精品久久国产丁香花| 亚洲中文一区二区av| 国产成人亚洲综合图区| 91久久天天躁狠狠躁夜夜| 乱60一70归性欧老妇| 少妇人妻真实偷人精品| 国产中文字幕日韩精品| 国产拗精品一区二区三区| 免费播放一区二区三区| 丰满无码人妻热妇无码区| 日本少妇被黑人xxxxx| 国内在线视频一区二区三区| 77777亚洲午夜久久多人| 免费一区二三区三区蜜桃|