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)
- 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
参数
- 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
参数
- 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
参数
- 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
参数
- 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
参数
- value
- Half
要转换的半精度浮点值。
返回
如果转换成功,true
;否则 false
。
适用于
TryWriteBytes(Span<Byte>, Int128)
- Source:
- BitConverter.cs
将 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)
- 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
参数
- 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
参数
- 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
参数
- value
- Single
要转换的单精度浮点值。
返回
如果转换成功,true
;否则 false
。
适用于
TryWriteBytes(Span<Byte>, UInt128)
- Source:
- BitConverter.cs
重要
此 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)
- 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
参数
- 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
参数
- 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
参数
- value
- UInt64
要转换的无符号 64 位整数。
返回
如果转换成功,true
;否则 false
。
- 属性