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

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

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

      NewSlot and ReuseSlot

      namespace CSharpTester
      {
      class Program
      {
      static void Main(string[] args)
      {
      var methodA
      = typeof(A).GetMethod("Test");
      PrintAttributes(
      typeof(System.Reflection.MethodAttributes), (int)methodA.Attributes);

      var methodB
      = typeof(B).GetMethod("Test");
      PrintAttributes(
      typeof(System.Reflection.MethodAttributes), (int)methodB.Attributes);
      }
      public static void PrintAttributes(Type attribType, int iAttribValue)
      {
      if (!attribType.IsEnum) { Console.WriteLine("This type is not an enum."); return; }

      FieldInfo[] fields
      = attribType.GetFields(BindingFlags.Public | BindingFlags.Static);
      for (int i = 0; i < fields.Length; i++)
      {
      int fieldvalue = (Int32)fields[i].GetValue(null);
      if ((fieldvalue & iAttribValue) == fieldvalue)
      {
      Console.WriteLine(fields[i].Name);
      }
      }
      }
      }
      public interface IA
      {
      void Test();

      void Test1();
      }
      public class A : IA
      {
      public void Test() { Console.WriteLine(1); }
      void IA.Test1() { Console.WriteLine(1); }
      public void Test2() { Console.WriteLine(1); }
      public void Test3() { Console.WriteLine(1); }
      public void Test4() { Console.WriteLine(1); }
      public void Test5() { Console.WriteLine(1); }
      }
      public class B : IA
      {
      public void A1() { Console.WriteLine(1); }
      public void A2() { Console.WriteLine(1); }
      public void A3() { Console.WriteLine(1); }
      public void Test() { Console.WriteLine(1); }
      public void Test1() { Console.WriteLine(1); }
      public void Test2() { Console.WriteLine(1); }
      }


      }

       

       

      兩個類A,B 繼承接口IA,都實現方法Test

      以下是運行結果

       

      兩個都出現了newslot 和reuseslot,結論是都重用了同樣的slot,繼承以后所有父類,接口的槽的位置不變

      以下是這兩個的定義

           
      Supported by the XNA Framework ReuseSlot Indicates that the method will reuse an existing slot in the vtable. This is the default behavior.
      Supported by the XNA Framework NewSlot Indicates that the method always gets a new slot in the vtable.

      url:http://msdn.microsoft.com/en-us/library/system.reflection.methodattributes.aspx

      (我的理解就是 有newslot的 說明在當前類型有實現了,否則就在父類或者外部;有reuseslot的就說明該方法必然是重寫或者繼承自父類,當然方法偏移量應該是要一致的)

      如果某個類并沒有實現某個方法,而是繼承自其父類的實現

      那么newslot為false  而reuseslot為true

      以下是代碼

      namespace CSharpTester
      {
      class Program
      {
      static void Main(string[] args)
      {
      var methodA
      = typeof(A).GetMethod("A1");

      PrintAttributes(
      typeof(System.Reflection.MethodAttributes), (int)methodA.Attributes);
      }
      public static void PrintAttributes(Type attribType, int iAttribValue)
      {
      if (!attribType.IsEnum) { Console.WriteLine("This type is not an enum."); return; }

      FieldInfo[] fields
      = attribType.GetFields(BindingFlags.Public | BindingFlags.Static);
      for (int i = 0; i < fields.Length; i++)
      {
      int fieldvalue = (Int32)fields[i].GetValue(null);
      if ((fieldvalue & iAttribValue) == fieldvalue)
      {
      Console.WriteLine(fields[i].Name);
      }
      }
      }
      }
      public class A : B
      {
      }
      public class B
      {
      public void A1() { Console.WriteLine(1); }
      }
      }

      以下是運行結果,有ReuseSlot 沒有NewSlot

       

       

       

      多繼承接口的情況下,還需要進一步分析

      posted on 2011-09-20 21:55  聽說讀寫  閱讀(701)  評論(0)    收藏  舉報

      導航

      主站蜘蛛池模板: 日韩精品射精管理在线观看| 精品少妇人妻av无码久久| 久久亚洲国产品一区二区| 精品久久久久久中文字幕| 日韩成人午夜精品久久高潮| 亚洲尤码不卡av麻豆| 一本一道av无码中文字幕麻豆| 高潮迭起av乳颜射后入| 无码精品人妻一区二区三区老牛| 风流老熟女一区二区三区| 亚欧美闷骚院| 乱码精品一区二区亚洲区| 久久亚洲精品情侣| 亚洲免费成人av一区| 久久天堂无码av网站| 最新国产精品拍自在线播放| 自拍偷拍一区二区三区四| 无遮挡粉嫩小泬久久久久久久| 亚洲国产女性内射第一区| 好男人官网资源在线观看| 在线高清免费不卡全码| 无码国内精品久久人妻蜜桃| 无码人妻av免费一区二区三区| 欧美精品一产区二产区| 欧美xxxx做受欧美| 国产精品视频第一第二区| 最近中文字幕免费手机版| 太深太粗太爽太猛了视频| 高清无码爆乳潮喷在线观看| 无套内谢少妇毛片aaaa片免费| 精品国产伦理国产无遮挡| 国产久免费热视频在线观看| 国产精品亚洲二区亚瑟| 国产另类ts人妖一区二区| 久久综合亚洲鲁鲁九月天| 亚洲精品岛国片在线观看| 中文字幕精品亚洲无线码二区| 国产成人午夜福利精品| 婷婷丁香五月亚洲中文字幕| 国产极品嫩模在线观看91| 五月天丁香婷婷亚洲欧洲国产|