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) |
將128位帶正負號的整數轉換成位元組範圍。 |
TryWriteBytes(Span<Byte>, Int16) |
將16位帶正負號的整數轉換成位元組範圍。 |
TryWriteBytes(Span<Byte>, Int32) |
將32位帶正負號的整數轉換成位元組範圍。 |
TryWriteBytes(Span<Byte>, Single) |
將單精度浮點數轉換成位元組範圍。 |
TryWriteBytes(Span<Byte>, UInt128) |
將128位無符號整數轉換成位元組範圍。 |
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)
將128位帶正負號的整數轉換成位元組範圍。
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
要轉換的128位帶正負號整數。
傳回
如果轉換成功,true
;否則 false
。
適用於
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 規範。
將128位無符號整數轉換成位元組範圍。
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
要轉換的128位無符號整數。
傳回
如果轉換成功,true
;否則 false
。
- 屬性
適用於
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
。
- 屬性