語言

IntPtr.Explicit 運算子

定義

將指定的資料型態轉換為 IntPtr 值,或 IntPtr 將值轉換為指定的資料型態。

多載

名稱 Description
Explicit(IntPtr to Void*)

將指定的 IntPtr 值轉換為未指定型別的指標。

此 API 不符合 CLS 規範。

Explicit(IntPtr to Int64)

將指定的 IntPtr 值轉換為 64 位元有符號整數。

Explicit(Void* to IntPtr)

將指定的指標轉換為未指定型態。IntPtr

此 API 不符合 CLS 規範。

Explicit(Int64 to IntPtr)

將一個 64 位元有符號整數 IntPtr的值轉換為 。

Explicit(Int32 to IntPtr)

將一個 32 位元有符號整數 IntPtr的值轉換為 。

Explicit(IntPtr to Int32)

將指定的 IntPtr 值轉換為 32 位元有符號整數。

Explicit(IntPtr to Void*)

來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
IntPtr.cs

重要

此 API 不符合 CLS 規範。

將指定的 IntPtr 值轉換為未指定型別的指標。

此 API 不符合 CLS 規範。

public:
 static explicit operator void*(IntPtr value);
[System.CLSCompliant(false)]
public static explicit operator void*(IntPtr value);
[<System.CLSCompliant(false)>]
static member op_Explicit : nativeint -> nativeptr<unit>

參數

value
IntPtr

nativeint

要轉換的有符號整數。

傳回

Void*

內容 value。

屬性

另請參閱

適用於

Explicit(IntPtr to Int64)

來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
IntPtr.cs

將指定的 IntPtr 值轉換為 64 位元有符號整數。

public:
 static explicit operator long(IntPtr value);
public static explicit operator long(IntPtr value);
static member op_Explicit : nativeint -> int64
Public Shared Narrowing Operator CType (value As IntPtr) As Long

參數

value
IntPtr

nativeint

要轉換的有符號整數。

傳回

內容 value。

另請參閱

適用於

Explicit(Void* to IntPtr)

來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
IntPtr.cs

重要

此 API 不符合 CLS 規範。

將指定的指標轉換為未指定型態。IntPtr

此 API 不符合 CLS 規範。

public:
 static explicit operator IntPtr(void* value);
[System.CLSCompliant(false)]
[System.Security.SecurityCritical]
public static explicit operator IntPtr(void* value);
[System.CLSCompliant(false)]
public static explicit operator IntPtr(void* value);
[<System.CLSCompliant(false)>]
[<System.Security.SecurityCritical>]
static member op_Explicit : nativeptr<unit> -> nativeint
[<System.CLSCompliant(false)>]
static member op_Explicit : nativeptr<unit> -> nativeint

參數

value
Void*

一個指向未指定型態的指標。

傳回

IntPtr

nativeint

一個新的實例 初始 IntPtr 化為 value。

屬性

另請參閱

適用於

Explicit(Int64 to IntPtr)

來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
IntPtr.cs

將一個 64 位元有符號整數 IntPtr的值轉換為 。

public:
 static explicit operator IntPtr(long value);
public static explicit operator IntPtr(long value);
static member op_Explicit : int64 -> nativeint
Public Shared Narrowing Operator CType (value As Long) As IntPtr

參數

value
Int64

64 位帶正負號的整數。

傳回

IntPtr

nativeint

一個新的實例 初始 IntPtr 化為 value。

例外狀況

在 32 位元的程序中, 太大 value 無法表示為 IntPtr。

另請參閱

適用於

Explicit(Int32 to IntPtr)

來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
IntPtr.cs

將一個 32 位元有符號整數 IntPtr的值轉換為 。

public:
 static explicit operator IntPtr(int value);
public static explicit operator IntPtr(int value);
static member op_Explicit : int -> nativeint
Public Shared Narrowing Operator CType (value As Integer) As IntPtr

參數

value
Int32

32 位帶正負號的整數。

傳回

IntPtr

nativeint

一個新的實例 初始 IntPtr 化為 value。

另請參閱

適用於

Explicit(IntPtr to Int32)

來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
IntPtr.cs

將指定的 IntPtr 值轉換為 32 位元有符號整數。

public:
 static explicit operator int(IntPtr value);
public static explicit operator int(IntPtr value);
static member op_Explicit : nativeint -> int
Public Shared Narrowing Operator CType (value As IntPtr) As Integer

參數

value
IntPtr

nativeint

要轉換的有符號整數。

傳回

內容 value。

例外狀況

在 64 位元程序中,的 value 值太大,無法以 32 位元有符號整數表示。

備註

只有當 的 value 值需要比執行程序支援的位元更多時,才會拋出例外。

另請參閱

適用於