IntPtr 构造函数

定义

初始化 的新 IntPtr实例。

重载

名称 说明
IntPtr(Int32)

初始化使用指定的 32 位有符号整数的新实例 IntPtr

IntPtr(Int64)

初始化使用指定的 64 位有符号整数的新实例 IntPtr

IntPtr(Void*)

初始化使用指向未指定类型的指定指针的新实例 IntPtr

IntPtr(Int32)

Source:
IntPtr.cs
Source:
IntPtr.cs
Source:
IntPtr.cs
Source:
IntPtr.cs
Source:
IntPtr.cs

初始化使用指定的 32 位有符号整数的新实例 IntPtr

public:
 IntPtr(int value);
public IntPtr(int value);
new nativeint : int -> nativeint
Public Sub New (value As Integer)

参数

value
Int32

32 位有符号整数。

适用于

IntPtr(Int64)

Source:
IntPtr.cs
Source:
IntPtr.cs
Source:
IntPtr.cs
Source:
IntPtr.cs
Source:
IntPtr.cs

初始化使用指定的 64 位有符号整数的新实例 IntPtr

public:
 IntPtr(long value);
public IntPtr(long value);
new nativeint : int64 -> nativeint
Public Sub New (value As Long)

参数

value
Int64

64 位有符号整数。

例外

在 32 位进程中, value 太大或太小,无法表示为一个 IntPtr

注解

仅当需要比执行进程支持的位数更多的位时 value ,才会引发异常。

适用于

IntPtr(Void*)

Source:
IntPtr.cs
Source:
IntPtr.cs
Source:
IntPtr.cs
Source:
IntPtr.cs
Source:
IntPtr.cs

重要

此 API 不符合 CLS。

初始化使用指向未指定类型的指定指针的新实例 IntPtr

public:
 IntPtr(void* value);
[System.CLSCompliant(false)]
[System.Security.SecurityCritical]
public IntPtr(void* value);
[System.CLSCompliant(false)]
public IntPtr(void* value);
[<System.CLSCompliant(false)>]
[<System.Security.SecurityCritical>]
new nativeint : nativeptr<unit> -> nativeint
[<System.CLSCompliant(false)>]
new nativeint : nativeptr<unit> -> nativeint

参数

value
Void*

指向未指定类型的指针。

属性

另请参阅

适用于