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 类型的值。

例外

大小 TFromTTo 大小不同。

适用于