Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

IntPtr Structure

A platform-specific type that is used to represent a pointer or a handle.

For a list of all members of this type, see IntPtr Members.

System.Object
   System.ValueType
      System.IntPtr

[Visual Basic]
<Serializable>
Public Structure IntPtr
   Implements ISerializable
[C#]
[Serializable]
public struct IntPtr : ISerializable
[C++]
[Serializable]
public __value struct IntPtr : public ISerializable

[JScript] In JScript, you can use the structures in the .NET Framework, but you cannot define your own.

Thread Safety

This type is safe for multithreaded operations.

Remarks

The IntPtr type is designed to be an integer whose size is platform-specific. That is, an instance of this type is expected to be 32-bits on 32-bit hardware and operating systems, and 64-bits on 64-bit hardware and operating systems.

The IntPtr type can be used by languages that support pointers, and as a common means of referring to data between languages that do and do not support pointers.

IntPtr objects can also be used to hold handles. For example, instances of IntPtr are used extensively in the System.IO.FileStream class to hold file handles.

The IntPtr type is CLS-compliant, while the UIntPtr type is not. Only the IntPtr type is used in the common language runtime. The UIntPtr type is provided mostly to maintain architectural symmetry with the IntPtr type.

This type implements the ISerializable interface.

Requirements

Namespace: System

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

Assembly: Mscorlib (in Mscorlib.dll)

See Also

IntPtr Members | System Namespace | UIntPtr

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft