using System;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
namespace System
{
/// A platform-specific type that is used to represent a pointer or a handle.
/// 1
// Token: 0x02000023 RID: 35
[ComVisible(true)]
[Serializable]
public struct IntPtr : ISerializable
{
/// Initializes a new instance of using the specified 32-bit pointer or handle.
/// A pointer or handle contained in a 32-bit signed integer.
// Token: 0x0600035D RID: 861 RVA: 0x0000D8BC File Offset: 0x0000BABC
[ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
public IntPtr(int value)
{
this.m_value = value;
}
/// Initializes a new instance of using the specified 64-bit pointer.
/// A pointer or handle contained in a 64-bit signed integer.
/// On a 32-bit platform, is too large or too small to represent as an .
// Token: 0x0600035E RID: 862 RVA: 0x0000D8C8 File Offset: 0x0000BAC8
[ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
public IntPtr(long value)
{
this.m_value = value;
}
/// Initializes a new instance of using the specified pointer to an unspecified type.
/// A pointer to an unspecified type.
// Token: 0x0600035F RID: 863 RVA: 0x0000D8D4 File Offset: 0x0000BAD4
[CLSCompliant(false)]
[ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
public unsafe IntPtr(void* value)
{
this.m_value = value;
}
// Token: 0x06000360 RID: 864 RVA: 0x0000D8E0 File Offset: 0x0000BAE0
private IntPtr(SerializationInfo info, StreamingContext context)
{
long @int = info.GetInt64("value");
this.m_value = @int;
}
/// Populates a object with the data needed to serialize the current object.
/// The object to populate with data.
/// The destination for this serialization. (This parameter is not used; specify null.)
///
/// is null.
// Token: 0x06000361 RID: 865 RVA: 0x0000D904 File Offset: 0x0000BB04
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
{
throw new ArgumentNullException("info");
}
info.AddValue("value", this.ToInt64());
}
/// Gets the size of this instance.
/// The size of a pointer or handle on this platform, measured in bytes. The value of this property is 4 on a 32-bit platform, and 8 on a 64-bit platform.
/// 1
// Token: 0x1700000B RID: 11
// (get) Token: 0x06000362 RID: 866 RVA: 0x0000D934 File Offset: 0x0000BB34
public unsafe static int Size
{
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
get
{
return sizeof(void*);
}
}
/// Returns a value indicating whether this instance is equal to a specified object.
/// true if is an instance of and equals the value of this instance; otherwise, false.
/// An object to compare with this instance or null.
/// 2
// Token: 0x06000363 RID: 867 RVA: 0x0000D93C File Offset: 0x0000BB3C
public override bool Equals(object obj)
{
return obj is IntPtr && ((IntPtr)obj).m_value == this.m_value;
}
/// Returns the hash code for this instance.
/// A 32-bit signed integer hash code.
/// 2
// Token: 0x06000364 RID: 868 RVA: 0x0000D96C File Offset: 0x0000BB6C
public override int GetHashCode()
{
return this.m_value;
}
/// Converts the value of this instance to a 32-bit signed integer.
/// A 32-bit signed integer equal to the value of this instance.
/// On a 64-bit platform, the value of this instance is too large or too small to represent as a 32-bit signed integer.
/// 1
// Token: 0x06000365 RID: 869 RVA: 0x0000D978 File Offset: 0x0000BB78
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public int ToInt32()
{
return this.m_value;
}
/// Converts the value of this instance to a 64-bit signed integer.
/// A 64-bit signed integer equal to the value of this instance.
/// 1
// Token: 0x06000366 RID: 870 RVA: 0x0000D984 File Offset: 0x0000BB84
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public long ToInt64()
{
if (IntPtr.Size == 4)
{
return (long)this.m_value;
}
return this.m_value;
}
/// Converts the value of this instance to a pointer to an unspecified type.
/// A pointer to ; that is, a pointer to memory containing data of an unspecified type.
/// 1
// Token: 0x06000367 RID: 871 RVA: 0x0000D9A4 File Offset: 0x0000BBA4
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[CLSCompliant(false)]
public unsafe void* ToPointer()
{
return this.m_value;
}
/// Converts the numeric value of the current object to its equivalent string representation.
/// The string representation of the value of this instance.
/// 1
// Token: 0x06000368 RID: 872 RVA: 0x0000D9AC File Offset: 0x0000BBAC
public override string ToString()
{
return this.ToString(null);
}
/// Converts the numeric value of the current object to its equivalent string representation.
/// The string representation of the value of the current object.
/// A format specification that governs how the current object is converted.
/// 1
// Token: 0x06000369 RID: 873 RVA: 0x0000D9B8 File Offset: 0x0000BBB8
public string ToString(string format)
{
if (IntPtr.Size == 4)
{
return this.m_value.ToString(format);
}
return this.m_value.ToString(format);
}
/// Determines whether two specified instances of are equal.
/// true if equals ; otherwise, false.
/// An .
/// An .
/// 3
// Token: 0x0600036A RID: 874 RVA: 0x0000D9F4 File Offset: 0x0000BBF4
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static bool operator ==(IntPtr value1, IntPtr value2)
{
return value1.m_value == value2.m_value;
}
/// Determines whether two specified instances of are not equal.
/// true if does not equal ; otherwise, false.
/// An .
/// An .
/// 3
// Token: 0x0600036B RID: 875 RVA: 0x0000DA08 File Offset: 0x0000BC08
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static bool operator !=(IntPtr value1, IntPtr value2)
{
return value1.m_value != value2.m_value;
}
/// Converts the value of a 32-bit signed integer to an .
/// A new instance of initialized to .
/// A 32-bit signed integer.
/// 3
// Token: 0x0600036C RID: 876 RVA: 0x0000DA20 File Offset: 0x0000BC20
[ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
public static explicit operator IntPtr(int value)
{
return new IntPtr(value);
}
/// Converts the value of a 64-bit signed integer to an .
/// A new instance of initialized to .
/// A 64-bit signed integer.
/// On a 32-bit platform, is too large to represent as an .
/// 3
// Token: 0x0600036D RID: 877 RVA: 0x0000DA28 File Offset: 0x0000BC28
[ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
public static explicit operator IntPtr(long value)
{
return new IntPtr(value);
}
/// Converts the specified pointer to an unspecified type to an .
/// A new instance of initialized to .
/// A pointer to an unspecified type.
/// 3
// Token: 0x0600036E RID: 878 RVA: 0x0000DA30 File Offset: 0x0000BC30
[CLSCompliant(false)]
[ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
public unsafe static explicit operator IntPtr(void* value)
{
return new IntPtr(value);
}
/// Converts the value of the specified to a 32-bit signed integer.
/// The contents of .
/// An .
/// On a 64-bit platform, the value of is too large to represent as a 32-bit signed integer.
/// 3
// Token: 0x0600036F RID: 879 RVA: 0x0000DA38 File Offset: 0x0000BC38
public static explicit operator int(IntPtr value)
{
return value.m_value;
}
/// Converts the value of the specified to a 64-bit signed integer.
/// The contents of .
/// An .
/// 3
// Token: 0x06000370 RID: 880 RVA: 0x0000DA44 File Offset: 0x0000BC44
public static explicit operator long(IntPtr value)
{
return value.ToInt64();
}
/// Converts the value of the specified to a pointer to an unspecified type.
/// The contents of .
/// An .
/// 3
// Token: 0x06000371 RID: 881 RVA: 0x0000DA50 File Offset: 0x0000BC50
[CLSCompliant(false)]
public unsafe static explicit operator void*(IntPtr value)
{
return value.m_value;
}
// Token: 0x04000056 RID: 86
private unsafe void* m_value;
/// A read-only field that represents a pointer or handle that has been initialized to zero.
/// 1
// Token: 0x04000057 RID: 87
public static readonly IntPtr Zero;
}
}