System.IntPtr

using System.Runtime.InteropServices;
using System.Globalization;
namespace System
{
[StructLayout(LayoutKind.Sequential,CharSet=CharSet.Ansi),Serializable,ComVisible(true)]
public struct IntPtr:System.Runtime.Serialization.ISerializable
{  
 private void* m_value;
 public static readonly System.IntPtr Zero;
      [System.Runtime.ConstrainedExecution.ReliabilityContractAttribute(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState,System.Runtime.ConstrainedExecution.Cer.Success)]
 internal bool IsNull()
 {    
   //.maxstack  8
   //IL_0000:  ldarg.0
   //IL_0001:  ldfld      void* System.IntPtr::m_value
   //IL_0006:  ldc.i4.0
   //IL_0007:  conv.u
   //IL_0008:  ceq
   //IL_000a:  ret
          return this.m_value == null;
 }
      [System.Runtime.ConstrainedExecution.ReliabilityContractAttribute(System.Runtime.ConstrainedExecution.Consistency.MayCorruptInstance, System.Runtime.ConstrainedExecution.Cer.MayFail)]
 public IntPtr(int @value)
 {    
   //.maxstack  8
   //IL_0000:  ldarg.0
   //IL_0001:  ldarg.1
   //IL_0002:  conv.i
   //IL_0003:  stfld      void* System.IntPtr::m_value
   //IL_0008:  ret
          this.m_value = (void*)@value;
 }
 public IntPtr(long @value)
 {
   //System.Runtime.ConstrainedExecution.ReliabilityContractAttribute(System.Runtime.ConstrainedExecution.Consistency.MayCorruptInstance,System.Runtime.ConstrainedExecution.Cer.MayFail)
   //.maxstack  8
   //IL_0000:  ldarg.0
   //IL_0001:  ldarg.1
   //IL_0002:  conv.ovf.i4
   //IL_0003:  conv.i
   //IL_0004:  stfld      void* System.IntPtr::m_value
   //IL_0009:  ret
          this.m_value = (void*)checked((int)@value);
 }
 public IntPtr(void* @value)
 {
   //System.CLSCompliantAttribute(false)
   //System.Runtime.ConstrainedExecution.ReliabilityContractAttribute(System.Runtime.ConstrainedExecution.Consistency.MayCorruptInstance,System.Runtime.ConstrainedExecution.Cer.MayFail)
   //.maxstack  8
   //IL_0000:  ldarg.0
   //IL_0001:  ldarg.1
   //IL_0002:  stfld      void* System.IntPtr::m_value
   //IL_0007:  ret
          this.m_value = @value;
 }
 private IntPtr( System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
 {
   //.maxstack  2
   //.locals init (int64 V_0)
   //IL_0000:  ldarg.1
   //IL_0001:  ldstr      "value"
   //IL_0006:  callvirt   instance int64 System.Runtime.Serialization.SerializationInfo::GetInt64(string)
   //IL_000b:  stloc.0
   //IL_000c:  call       int32 System.IntPtr::get_Size()
   //IL_0011:  ldc.i4.4
   //IL_0012:  bne.un.s   IL_0036
   //IL_0014:  ldloc.0
   //IL_0015:  ldc.i4     0x7fffffff
   //IL_001a:  conv.i8
   //IL_001b:  bgt.s      IL_0026
   //IL_001d:  ldloc.0
   //IL_001e:  ldc.i4     0x80000000
   //IL_0023:  conv.i8
   //IL_0024:  bge.s      IL_0036
   //IL_0026:  ldstr      "Serialization_InvalidPtrValue"
   //IL_002b:  call       string System.Environment::GetResourceString(string)
   //IL_0030:  newobj     instance void System.ArgumentException::.ctor(string)
   //IL_0035:  throw
   //IL_0036:  ldarg.0
   //IL_0037:  ldloc.0
   //IL_0038:  conv.u
   //IL_0039:  stfld      void* System.IntPtr::m_value
   //IL_003e:  ret
          long V_0;
          V_0=info.GetInt64("value");
          if (System.IntPtr.Size == 4)
          {
              if (V_0 <= (long)0x7fffffff && V_0 >= (long)unchecked((int)0x80000000))
              {
                  this.m_value = (void*)V_0;
              }
              else
              {
                  throw new System.ArgumentException(System.Environment.GetResourceString("Serialization_InvalidPtrValue"));
              }
          }
          else
          {
              this.m_value = (void*)V_0;
          }

 }
 new virtual sealed void System.Runtime.Serialization.ISerializable.GetObjectData( System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
 {    
   //.maxstack  8
   //IL_0000:  ldarg.1
   //IL_0001:  brtrue.s   IL_000e
   //IL_0003:  ldstr      "info"
   //IL_0008:  newobj     instance void System.ArgumentNullException::.ctor(string)
   //IL_000d:  throw
   //IL_000e:  ldarg.1
   //IL_000f:  ldstr      "value"
   //IL_0014:  ldarg.0
   //IL_0015:  ldfld      void* System.IntPtr::m_value
   //IL_001a:  conv.i4
   //IL_001b:  conv.i8
   //IL_001c:  callvirt   instance void System.Runtime.Serialization.SerializationInfo::AddValue(string,
                                                                                               //int64)
   //IL_0021:  ret
          if (info == null)
          {
              throw new System.ArgumentNullException("info");
          }
          else
          {
              info.AddValue("value", (long)(int)this.m_value);
          }
 }
 public override bool Equals(object obj)
 {
   //.maxstack  2
   //.locals init (native int V_0)
   //IL_0000:  ldarg.1
   //IL_0001:  isinst     System.IntPtr
   //IL_0006:  brfalse.s  IL_001f
   //IL_0008:  ldarg.0
   //IL_0009:  ldfld      void* System.IntPtr::m_value
   //IL_000e:  ldarg.1
   //IL_000f:  unbox.any  System.IntPtr
   //IL_0014:  stloc.0
   //IL_0015:  ldloca.s   V_0
   //IL_0017:  ldfld      void* System.IntPtr::m_value
   //IL_001c:  ceq
   //IL_001e:  ret
   //IL_001f:  ldc.i4.0
   //IL_0020:  ret
          System.IntPtr V_0;
          if (obj is System.IntPtr)
          {
              V_0 = (System.IntPtr)obj;
              return this.m_value == V_0.m_value;
          }
          else
          {
              return false;
          }
 }
 public override int GetHashCode()
 {
   //.maxstack  8
   //IL_0000:  ldarg.0
   //IL_0001:  ldfld      void* System.IntPtr::m_value
   //IL_0006:  conv.u8
   //IL_0007:  conv.i4
   //IL_0008:  ret
          return (int)(ulong)this.m_value;
 }
        [System.Runtime.ConstrainedExecution.ReliabilityContractAttribute(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)]
 public int ToInt32()
 {    
   //.maxstack  8
   //IL_0000:  ldarg.0
   //IL_0001:  ldfld      void* System.IntPtr::m_value
   //IL_0006:  conv.i4
   //IL_0007:  ret
          return (int)this.m_value;
 }
        [System.Runtime.ConstrainedExecution.ReliabilityContractAttribute(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)]
 public long ToInt64()
 {
   //.maxstack  8
   //IL_0000:  ldarg.0
   //IL_0001:  ldfld      void* System.IntPtr::m_value
   //IL_0006:  conv.i4
   //IL_0007:  conv.i8
   //IL_0008:  ret
          return (long)(int)this.m_value;
 }
 public override string ToString()
 {
   //.maxstack  2
   //.locals init (int32 V_0)
   //IL_0000:  ldarg.0
   //IL_0001:  ldfld      void* System.IntPtr::m_value
   //IL_0006:  conv.i4
   //IL_0007:  stloc.0
   //IL_0008:  ldloca.s   V_0
   //IL_000a:  call       class System.Globalization.CultureInfo System.Globalization.CultureInfo::get_InvariantCulture()
   //IL_000f:  call       instance string System.Int32::ToString(class System.IFormatProvider)
   //IL_0014:  ret
          int V_0;
          V_0=(int)this.m_value;
          return V_0.ToString(CultureInfo.InvariantCulture);
 }
 public string ToString(string format)
 {
   //.maxstack  3
   //.locals init (int32 V_0)
   //IL_0000:  ldarg.0
   //IL_0001:  ldfld      void* System.IntPtr::m_value
   //IL_0006:  conv.i4
   //IL_0007:  stloc.0
   //IL_0008:  ldloca.s   V_0
   //IL_000a:  ldarg.1
   //IL_000b:  call       class System.Globalization.CultureInfo System.Globalization.CultureInfo::get_InvariantCulture()
   //IL_0010:  call       instance string System.Int32::ToString(string,
                                                               //class System.IFormatProvider)
   //IL_0015:  ret
          int V_0;
          V_0 = (int)this.m_value;
          return V_0.ToString(format,CultureInfo.InvariantCulture);
 }
        [System.Runtime.ConstrainedExecution.ReliabilityContractAttribute(System.Runtime.ConstrainedExecution.Consistency.MayCorruptInstance, System.Runtime.ConstrainedExecution.Cer.MayFail)]
 public static System.IntPtr op_Explicit(int @value)
 {
   //.maxstack  8
   //IL_0000:  ldarg.0
   //IL_0001:  newobj     instance void System.IntPtr::.ctor(int32)
   //IL_0006:  ret
          return new IntPtr(@value);
 }
        [System.Runtime.ConstrainedExecution.ReliabilityContractAttribute(System.Runtime.ConstrainedExecution.Consistency.MayCorruptInstance, System.Runtime.ConstrainedExecution.Cer.MayFail)]
      public static System.IntPtr op_Explicit(long @value)
 {    
   //.maxstack  8
   //IL_0000:  ldarg.0
   //IL_0001:  newobj     instance void System.IntPtr::.ctor(int64)
   //IL_0006:  ret
          return new IntPtr(@value);
 }
        [CLSCompliant(false)]
        [System.Runtime.ConstrainedExecution.ReliabilityContractAttribute(System.Runtime.ConstrainedExecution.Consistency.MayCorruptInstance, System.Runtime.ConstrainedExecution.Cer.MayFail)]
      public static System.IntPtr op_Explicit(void* @value)
 {    
   //.maxstack  8
   //IL_0000:  ldarg.0
   //IL_0001:  newobj     instance void System.IntPtr::.ctor(void*)
   //IL_0006:  ret
          return new System.IntPtr(@value);
 }
        [CLSCompliant(false)]
        public static void* op_Explicit(System.IntPtr @value)
 {    
   //.maxstack  8
   //IL_0000:  ldarga.s   'value'
   //IL_0002:  call       instance void* System.IntPtr::ToPointer()
   //IL_0007:  ret
          return @value.ToPointer();
 }
        public static int op_Explicit(System.IntPtr @value)
 {
   //.maxstack  8
   //IL_0000:  ldarga.s   'value'
   //IL_0002:  ldfld      void* System.IntPtr::m_value
   //IL_0007:  conv.i4
   //IL_0008:  ret
          return (int)@value.m_value;
 }
      public static long op_Explicit(System.IntPtr @value)
 {
   //.maxstack  8
   //IL_0000:  ldarga.s   'value'
   //IL_0002:  ldfld      void* System.IntPtr::m_value
   //IL_0007:  conv.i4
   //IL_0008:  conv.i8
   //IL_0009:  ret
          return (long)(int)@value.m_value;
 }
        [System.Runtime.ConstrainedExecution.ReliabilityContractAttribute(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)]
      public static bool op_Equality(System.IntPtr value1, System.IntPtr value2)
 {    
   //.maxstack  8
   //IL_0000:  ldarga.s   value1
   //IL_0002:  ldfld      void* System.IntPtr::m_value
   //IL_0007:  ldarga.s   value2
   //IL_0009:  ldfld      void* System.IntPtr::m_value
   //IL_000e:  ceq
   //IL_0010:  ret
            return @value2.m_value==value2.m_value;
 }
        [System.Runtime.ConstrainedExecution.ReliabilityContractAttribute(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)]
        public static bool op_Inequality(System.IntPtr value1, System.IntPtr value2)
 {   
   //.maxstack  8
   //IL_0000:  ldarga.s   value1
   //IL_0002:  ldfld      void* System.IntPtr::m_value
   //IL_0007:  ldarga.s   value2
   //IL_0009:  ldfld      void* System.IntPtr::m_value
   //IL_000e:  ceq
   //IL_0010:  ldc.i4.0
   //IL_0011:  ceq
   //IL_0013:  ret
          return (@value2.m_value == value2.m_value) == false;
 }
      public static int Size
      {
          get
          {
              ;
          }
          //.get int32 System.IntPtr::get_Size()
      }
      [System.Runtime.ConstrainedExecution.ReliabilityContractAttribute(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)]
 public static int get_Size()
 {
   //.maxstack  8
   //IL_0000:  ldc.i4.4
   //IL_0001:  ret
          return 4;
 }
 public void* ToPointer()
 {
   //System.CLSCompliantAttribute(false)
   //System.Runtime.ConstrainedExecution.ReliabilityContractAttribute(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState,System.Runtime.ConstrainedExecution.Cer.Success)
   //.maxstack  8
   //IL_0000:  ldarg.0
   //IL_0001:  ldfld      void* System.IntPtr::m_value
   //IL_0006:  ret
          return this.m_value;
 }  
}
}

转载于:https://www.cnblogs.com/MSIL/articles/1811405.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值