BitConverter.TryWriteBytes 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
TryWriteBytes(Span<Byte>, Int64) |
將 64 位元帶正負號的整數轉換為位元組範圍。 |
TryWriteBytes(Span<Byte>, Boolean) |
將布林值轉換為位元組範圍。 |
TryWriteBytes(Span<Byte>, Char) |
將字元轉換為位元組範圍。 |
TryWriteBytes(Span<Byte>, Double) |
將雙精確度浮點數值轉換為位元組範圍。 |
TryWriteBytes(Span<Byte>, Half) |
將半精確度浮點數轉換成位元組範圍。 |
TryWriteBytes(Span<Byte>, Int128) | |
TryWriteBytes(Span<Byte>, Int16) |
將 16 位元帶正負號的整數轉換為位元組範圍。 |
TryWriteBytes(Span<Byte>, Int32) |
將 32 位元帶正負號的整數轉換為位元組範圍。 |
TryWriteBytes(Span<Byte>, Single) |
將單精度浮點數轉換成位元組範圍。 |
TryWriteBytes(Span<Byte>, UInt128) | |
TryWriteBytes(Span<Byte>, UInt16) |
將不帶正負號的 16 位元整數轉換為位元組範圍。 |
TryWriteBytes(Span<Byte>, UInt32) |
將 32 位元不帶正負號的整數轉換為位元組範圍。 |
TryWriteBytes(Span<Byte>, UInt64) |
將不帶正負號的 64 位元整數轉換為位元組範圍。 |
TryWriteBytes(Span<Byte>, Int64)
將 64 位元帶正負號的整數轉換為位元組範圍。
public:
static bool TryWriteBytes(Span<System::Byte> destination, long value);
public static bool TryWriteBytes (Span<byte> destination, long value);
static member TryWriteBytes : Span<byte> * int64 -> bool
Public Shared Function TryWriteBytes (destination As Span(Of Byte), value As Long) As Boolean
參數
- value
- Int64
要轉換的 64 位元帶正負號的整數。
傳回
如果轉換成功,則為 true
;否則為 false
。
適用於
TryWriteBytes(Span<Byte>, Boolean)
將布林值轉換為位元組範圍。
public:
static bool TryWriteBytes(Span<System::Byte> destination, bool value);
public static bool TryWriteBytes (Span<byte> destination, bool value);
static member TryWriteBytes : Span<byte> * bool -> bool
Public Shared Function TryWriteBytes (destination As Span(Of Byte), value As Boolean) As Boolean
參數
- value
- Boolean
要轉換的布林值。
傳回
如果轉換成功,則為 true
;否則為 false
。
適用於
TryWriteBytes(Span<Byte>, Char)
將字元轉換為位元組範圍。
public:
static bool TryWriteBytes(Span<System::Byte> destination, char value);
public static bool TryWriteBytes (Span<byte> destination, char value);
static member TryWriteBytes : Span<byte> * char -> bool
Public Shared Function TryWriteBytes (destination As Span(Of Byte), value As Char) As Boolean
參數
- value
- Char
要轉換的字元。
傳回
如果轉換成功,則為 true
;否則為 false
。
適用於
TryWriteBytes(Span<Byte>, Double)
將雙精確度浮點數值轉換為位元組範圍。
public:
static bool TryWriteBytes(Span<System::Byte> destination, double value);
public static bool TryWriteBytes (Span<byte> destination, double value);
static member TryWriteBytes : Span<byte> * double -> bool
Public Shared Function TryWriteBytes (destination As Span(Of Byte), value As Double) As Boolean
參數
- value
- Double
要轉換的雙精確度浮點數值。
傳回
如果轉換成功,則為 true
;否則為 false
。
適用於
TryWriteBytes(Span<Byte>, Half)
將半精確度浮點數轉換成位元組範圍。
public:
static bool TryWriteBytes(Span<System::Byte> destination, Half value);
public static bool TryWriteBytes (Span<byte> destination, Half value);
static member TryWriteBytes : Span<byte> * Half -> bool
Public Shared Function TryWriteBytes (destination As Span(Of Byte), value As Half) As Boolean
參數
- value
- Half
要轉換的半精確度浮點數。
傳回
如果轉換成功,則為 true
;否則為 false
。
適用於
TryWriteBytes(Span<Byte>, Int128)
public:
static bool TryWriteBytes(Span<System::Byte> destination, Int128 value);
public static bool TryWriteBytes (Span<byte> destination, Int128 value);
static member TryWriteBytes : Span<byte> * Int128 -> bool
Public Shared Function TryWriteBytes (destination As Span(Of Byte), value As Int128) As Boolean
參數
- value
- Int128
傳回
適用於
TryWriteBytes(Span<Byte>, Int16)
將 16 位元帶正負號的整數轉換為位元組範圍。
public:
static bool TryWriteBytes(Span<System::Byte> destination, short value);
public static bool TryWriteBytes (Span<byte> destination, short value);
static member TryWriteBytes : Span<byte> * int16 -> bool
Public Shared Function TryWriteBytes (destination As Span(Of Byte), value As Short) As Boolean
參數
- value
- Int16
要轉換的 16 位元帶正負號的整數。
傳回
如果轉換成功,則為 true
;否則為 false
。
適用於
TryWriteBytes(Span<Byte>, Int32)
將 32 位元帶正負號的整數轉換為位元組範圍。
public:
static bool TryWriteBytes(Span<System::Byte> destination, int value);
public static bool TryWriteBytes (Span<byte> destination, int value);
static member TryWriteBytes : Span<byte> * int -> bool
Public Shared Function TryWriteBytes (destination As Span(Of Byte), value As Integer) As Boolean
參數
- value
- Int32
要轉換的 32 位元帶正負號的整數。
傳回
如果轉換成功,則為 true
;否則為 false
。
適用於
TryWriteBytes(Span<Byte>, Single)
將單精度浮點數轉換成位元組範圍。
public:
static bool TryWriteBytes(Span<System::Byte> destination, float value);
public static bool TryWriteBytes (Span<byte> destination, float value);
static member TryWriteBytes : Span<byte> * single -> bool
Public Shared Function TryWriteBytes (destination As Span(Of Byte), value As Single) As Boolean
參數
- value
- Single
要轉換的單精確度浮點數值。
傳回
如果轉換成功,則為 true
;否則為 false
。
適用於
TryWriteBytes(Span<Byte>, UInt128)
重要
此 API 不符合 CLS 規範。
public:
static bool TryWriteBytes(Span<System::Byte> destination, UInt128 value);
[System.CLSCompliant(false)]
public static bool TryWriteBytes (Span<byte> destination, UInt128 value);
[<System.CLSCompliant(false)>]
static member TryWriteBytes : Span<byte> * UInt128 -> bool
Public Shared Function TryWriteBytes (destination As Span(Of Byte), value As UInt128) As Boolean
參數
- value
- UInt128
傳回
- 屬性
適用於
TryWriteBytes(Span<Byte>, UInt16)
重要
此 API 不符合 CLS 規範。
將不帶正負號的 16 位元整數轉換為位元組範圍。
public:
static bool TryWriteBytes(Span<System::Byte> destination, System::UInt16 value);
[System.CLSCompliant(false)]
public static bool TryWriteBytes (Span<byte> destination, ushort value);
[<System.CLSCompliant(false)>]
static member TryWriteBytes : Span<byte> * uint16 -> bool
Public Shared Function TryWriteBytes (destination As Span(Of Byte), value As UShort) As Boolean
參數
- value
- UInt16
要轉換之不帶正負號的 16 位元整數。
傳回
如果轉換成功,則為 true
;否則為 false
。
- 屬性
適用於
TryWriteBytes(Span<Byte>, UInt32)
重要
此 API 不符合 CLS 規範。
將 32 位元不帶正負號的整數轉換為位元組範圍。
public:
static bool TryWriteBytes(Span<System::Byte> destination, System::UInt32 value);
[System.CLSCompliant(false)]
public static bool TryWriteBytes (Span<byte> destination, uint value);
[<System.CLSCompliant(false)>]
static member TryWriteBytes : Span<byte> * uint32 -> bool
Public Shared Function TryWriteBytes (destination As Span(Of Byte), value As UInteger) As Boolean
參數
- value
- UInt32
要轉換之不帶正負號的 32 位元整數。
傳回
如果轉換成功,則為 true
;否則為 false
。
- 屬性
適用於
TryWriteBytes(Span<Byte>, UInt64)
重要
此 API 不符合 CLS 規範。
將不帶正負號的 64 位元整數轉換為位元組範圍。
public:
static bool TryWriteBytes(Span<System::Byte> destination, System::UInt64 value);
[System.CLSCompliant(false)]
public static bool TryWriteBytes (Span<byte> destination, ulong value);
[<System.CLSCompliant(false)>]
static member TryWriteBytes : Span<byte> * uint64 -> bool
Public Shared Function TryWriteBytes (destination As Span(Of Byte), value As ULong) As Boolean
參數
- value
- UInt64
要轉換的不帶正負號的 64 位元整數。
傳回
如果轉換成功,則為 true
;否則為 false
。
- 屬性
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應