BitConverter.TryWriteBytes 方法

定義

多載

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)

來源:
BitConverter.cs
來源:
BitConverter.cs
來源:
BitConverter.cs

將 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

參數

destination
Span<Byte>

當此方法傳回時,代表已轉換之 64位元 帶正負號的整數的位元組。

value
Int64

要轉換的 64 位元帶正負號的整數。

傳回

如果轉換成功,則為 true;否則為 false

適用於

TryWriteBytes(Span<Byte>, Boolean)

來源:
BitConverter.cs
來源:
BitConverter.cs
來源:
BitConverter.cs

將布林值轉換為位元組範圍。

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

參數

destination
Span<Byte>

當此方法傳回時,代表已轉換之布林值的位元組。

value
Boolean

要轉換的布林值。

傳回

如果轉換成功,則為 true;否則為 false

適用於

TryWriteBytes(Span<Byte>, Char)

來源:
BitConverter.cs
來源:
BitConverter.cs
來源:
BitConverter.cs

將字元轉換為位元組範圍。

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

參數

destination
Span<Byte>

當此方法傳回時,代表已轉換字元的位元組。

value
Char

要轉換的字元。

傳回

如果轉換成功,則為 true;否則為 false

適用於

TryWriteBytes(Span<Byte>, Double)

來源:
BitConverter.cs
來源:
BitConverter.cs
來源:
BitConverter.cs

將雙精確度浮點數值轉換為位元組範圍。

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

參數

destination
Span<Byte>

當此方法傳回時,代表已轉換之雙精確度浮點數值的位元組。

value
Double

要轉換的雙精確度浮點數值。

傳回

如果轉換成功,則為 true;否則為 false

適用於

TryWriteBytes(Span<Byte>, Half)

來源:
BitConverter.cs
來源:
BitConverter.cs
來源:
BitConverter.cs

將半精確度浮點數轉換成位元組範圍。

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

參數

destination
Span<Byte>

當這個方法傳回時,表示已轉換半精確度浮點值的位元組。

value
Half

要轉換的半精確度浮點數。

傳回

如果轉換成功,則為 true;否則為 false

適用於

TryWriteBytes(Span<Byte>, Int128)

來源:
BitConverter.cs
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

參數

destination
Span<Byte>
value
Int128

傳回

適用於

TryWriteBytes(Span<Byte>, Int16)

來源:
BitConverter.cs
來源:
BitConverter.cs
來源:
BitConverter.cs

將 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

參數

destination
Span<Byte>

當此方法傳回時,代表已轉換之 16 帶正負號的整數的位元組。

value
Int16

要轉換的 16 位元帶正負號的整數。

傳回

如果轉換成功,則為 true;否則為 false

適用於

TryWriteBytes(Span<Byte>, Int32)

來源:
BitConverter.cs
來源:
BitConverter.cs
來源:
BitConverter.cs

將 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

參數

destination
Span<Byte>

當此方法傳回時,代表已轉換之 32 帶正負號的整數的位元組。

value
Int32

要轉換的 32 位元帶正負號的整數。

傳回

如果轉換成功,則為 true;否則為 false

適用於

TryWriteBytes(Span<Byte>, Single)

來源:
BitConverter.cs
來源:
BitConverter.cs
來源:
BitConverter.cs

將單精度浮點數轉換成位元組範圍。

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

參數

destination
Span<Byte>

當這個方法傳回時,表示已轉換之單精度浮點值的位元組。

value
Single

要轉換的單精確度浮點數值。

傳回

如果轉換成功,則為 true;否則為 false

適用於

TryWriteBytes(Span<Byte>, UInt128)

來源:
BitConverter.cs

重要

此 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

參數

destination
Span<Byte>
value
UInt128

傳回

屬性

適用於

TryWriteBytes(Span<Byte>, UInt16)

來源:
BitConverter.cs
來源:
BitConverter.cs
來源:
BitConverter.cs

重要

此 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

參數

destination
Span<Byte>

當此方法傳回時,代表已轉換之不帶正負號 16 位元整數的位元組。

value
UInt16

要轉換之不帶正負號的 16 位元整數。

傳回

如果轉換成功,則為 true;否則為 false

屬性

適用於

TryWriteBytes(Span<Byte>, UInt32)

來源:
BitConverter.cs
來源:
BitConverter.cs
來源:
BitConverter.cs

重要

此 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

參數

destination
Span<Byte>

當此方法傳回時,代表已轉換之不帶正負號 32 位元整數的位元組。

value
UInt32

要轉換之不帶正負號的 32 位元整數。

傳回

如果轉換成功,則為 true;否則為 false

屬性

適用於

TryWriteBytes(Span<Byte>, UInt64)

來源:
BitConverter.cs
來源:
BitConverter.cs
來源:
BitConverter.cs

重要

此 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

參數

destination
Span<Byte>

當此方法傳回時,代表已轉換之不帶正負號 64 位元整數的位元組。

value
UInt64

要轉換的不帶正負號的 64 位元整數。

傳回

如果轉換成功,則為 true;否則為 false

屬性

適用於