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)

Source:
BitConverter.cs
Source:
BitConverter.cs
Source:
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)

Source:
BitConverter.cs
Source:
BitConverter.cs
Source:
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)

Source:
BitConverter.cs
Source:
BitConverter.cs
Source:
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)

Source:
BitConverter.cs
Source:
BitConverter.cs
Source:
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)

Source:
BitConverter.cs
Source:
BitConverter.cs
Source:
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)

Source:
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)

Source:
BitConverter.cs
Source:
BitConverter.cs
Source:
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)

Source:
BitConverter.cs
Source:
BitConverter.cs
Source:
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)

Source:
BitConverter.cs
Source:
BitConverter.cs
Source:
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)

Source:
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)

Source:
BitConverter.cs
Source:
BitConverter.cs
Source:
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)

Source:
BitConverter.cs
Source:
BitConverter.cs
Source:
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)

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

属性

适用于