The Labs \ Source Viewer \ SSCLI \ System.Runtime.CompilerServices \ MethodCodeType

  1. // ==++==
  2. //
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. //
  14. // ==--==
  15. namespace System.Runtime.CompilerServices
  16. {
  17.    
  18.     using System;
  19.     using System.Reflection;
  20.    
  21.     // This Enum matchs the miImpl flags defined in corhdr.h. It is used to specify
  22.     // certain method properties.
  23.    
  24.     [Serializable()]
  25.     [Flags()]
  26.     [System.Runtime.InteropServices.ComVisible(true)]
  27.     public enum MethodImplOptions
  28.     {
  29.         Unmanaged = System.Reflection.MethodImplAttributes.Unmanaged,
  30.         ForwardRef = System.Reflection.MethodImplAttributes.ForwardRef,
  31.         PreserveSig = System.Reflection.MethodImplAttributes.PreserveSig,
  32.         InternalCall = System.Reflection.MethodImplAttributes.InternalCall,
  33.         Synchronized = System.Reflection.MethodImplAttributes.Synchronized,
  34.         NoInlining = System.Reflection.MethodImplAttributes.NoInlining
  35.         // **** If you add something, update internal MethodImplAttribute(MethodImplAttributes methodImplAttributes)! ****
  36.     }
  37.    
  38.     [Serializable()]
  39.     [System.Runtime.InteropServices.ComVisible(true)]
  40.     public enum MethodCodeType
  41.     {
  42.         IL = System.Reflection.MethodImplAttributes.IL,
  43.         Native = System.Reflection.MethodImplAttributes.Native,
  44.         /// <internalonly/>
  45.         OPTIL = System.Reflection.MethodImplAttributes.OPTIL,
  46.         Runtime = System.Reflection.MethodImplAttributes.Runtime
  47.     }
  48.    
  49.     // Custom attribute to specify additional method properties.
  50.     [Serializable(), AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor, Inherited = false)]
  51.     [System.Runtime.InteropServices.ComVisible(true)]
  52.     public sealed class MethodImplAttribute : Attribute
  53.     {
  54.         internal MethodImplOptions _val;
  55.         public MethodCodeType MethodCodeType;
  56.        
  57.         internal MethodImplAttribute(MethodImplAttributes methodImplAttributes)
  58.         {
  59.             MethodImplOptions all = MethodImplOptions.Unmanaged | MethodImplOptions.ForwardRef | MethodImplOptions.PreserveSig | MethodImplOptions.InternalCall | MethodImplOptions.Synchronized | MethodImplOptions.NoInlining;
  60.             _val = ((MethodImplOptions)methodImplAttributes) & all;
  61.         }
  62.        
  63.         public MethodImplAttribute(MethodImplOptions methodImplOptions)
  64.         {
  65.             _val = methodImplOptions;
  66.         }
  67.        
  68.         public MethodImplAttribute(short value)
  69.         {
  70.             _val = (MethodImplOptions)value;
  71.         }
  72.        
  73.         public MethodImplAttribute()
  74.         {
  75.         }
  76.        
  77.         public MethodImplOptions Value {
  78.             get { return _val; }
  79.         }
  80.     }
  81.    
  82. }

Developer Fusion