語言

Unsafe.BitCast<TFrom,TTo>(TFrom) 方法

定義

將給定的值 TFrom 重新詮釋為型別 TTo的值。

public:
generic <typename TFrom, typename TTo>
 static TTo BitCast(TFrom source);
public:
generic <typename TFrom, typename TTo>
 where TFrom : value class where TTo : value class static TTo BitCast(TFrom source);
public static TTo BitCast<TFrom,TTo>(TFrom source) where TFrom : allows ref struct where TTo : allows ref struct;
public static TTo BitCast<TFrom,TTo>(TFrom source) where TFrom : struct where TTo : struct;
static member BitCast : 'From -> 'o
static member BitCast : 'From -> 'o (requires 'From : struct and 'o : struct)
Public Shared Function BitCast(Of TFrom, TTo) (source As TFrom) As TTo
Public Shared Function BitCast(Of TFrom As Structure, TTo As Structure) (source As TFrom) As TTo

類型參數

TFrom
TTo

參數

source
TFrom

傳回

TTo

型別 TTo 的值。

例外狀況

和TTo的TFrom大小並不相同。

適用於