Share via


Vector<T> 一律針對不支援的型別擲回 NotSupportedException

System.Numerics.Vector<T> 現在一律會針對不支援的型別參數擲回 NotSupportedException

變更描述

先前,若 T不支援的型別Vector<T> 的成員未必一律會擲回 NotSupportedException。 由於支援硬體加速的程式碼路徑,系統不一定擲回例外狀況。 例如,Vector<bool> + Vector<bool> 會傳回 default,而非擲回平台上沒有硬體加速的例外狀況,例如 Arm32。 針對不支援的型別,Vector<T> 成員會在不同的平台和硬體設定間展現不一致的行為。

從 .NET 5 開始,只要 T 不是支援的型別,Vector<T> 成員一律會在所有硬體設定上擲回 NotSupportedException

不支援的型別

Vector<T> 型別參數支援的型別為:

  • byte
  • sbyte
  • short
  • ushort
  • int
  • uint
  • long
  • ulong
  • float
  • double

支援的型別並未改變,不過未來有可能變更。

導入的版本

5.0

請勿針對 Vector<T> 的型別參數使用不支援的型別。

受影響的 API