Byte.TryFormat 方法  
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
| TryFormat(Span<Byte>, Int32, ReadOnlySpan<Char>, IFormatProvider) | 
						 尝试将当前实例的值格式化为 UTF-8,将其设置为提供的字节范围。  | 
        	
| TryFormat(Span<Char>, Int32, ReadOnlySpan<Char>, IFormatProvider) | 
						 尝试将当前 8 位无符号整数实例的值的格式设置为提供的字符范围。  | 
        	
TryFormat(Span<Byte>, Int32, ReadOnlySpan<Char>, IFormatProvider)
- Source:
 - Byte.cs
 
- Source:
 - Byte.cs
 
- Source:
 - Byte.cs
 
尝试将当前实例的值格式化为 UTF-8,将其设置为提供的字节范围。
public bool TryFormat(Span<byte> utf8Destination, out int bytesWritten, ReadOnlySpan<char> format = default, IFormatProvider? provider = default);
	abstract member TryFormat : Span<byte> * int * ReadOnlySpan<char> * IFormatProvider -> bool
override this.TryFormat : Span<byte> * int * ReadOnlySpan<char> * IFormatProvider -> bool
	Public Function TryFormat (utf8Destination As Span(Of Byte), ByRef bytesWritten As Integer, Optional format As ReadOnlySpan(Of Char) = Nothing, Optional provider As IFormatProvider = Nothing) As Boolean
	参数
- bytesWritten
 - Int32
 
此方法返回时,包含写入 的 utf8Destination字节数。
- format
 - ReadOnlySpan<Char>
 
一个包含字符的范围,这些字符表示定义可接受的 utf8Destination 格式的标准或自定义格式字符串。
- provider
 - IFormatProvider
 
一个可选对象,提供有关 utf8Destination 的区域性特定格式设置信息。
返回
如果格式设置成功,则为 true;否则为 false。
实现
适用于
TryFormat(Span<Char>, Int32, ReadOnlySpan<Char>, IFormatProvider)
- Source:
 - Byte.cs
 
- Source:
 - Byte.cs
 
- Source:
 - Byte.cs
 
- Source:
 - Byte.cs
 
尝试将当前 8 位无符号整数实例的值的格式设置为提供的字符范围。
public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format = default, IFormatProvider? provider = default);
	public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format = default, IFormatProvider provider = default);
	abstract member TryFormat : Span<char> * int * ReadOnlySpan<char> * IFormatProvider -> bool
override this.TryFormat : Span<char> * int * ReadOnlySpan<char> * IFormatProvider -> bool
	member this.TryFormat : Span<char> * int * ReadOnlySpan<char> * IFormatProvider -> bool
	Public Function TryFormat (destination As Span(Of Char), ByRef charsWritten As Integer, Optional format As ReadOnlySpan(Of Char) = Nothing, Optional provider As IFormatProvider = Nothing) As Boolean
	参数
- charsWritten
 - Int32
 
此方法返回时,为写入到 destination 的字符数。
- format
 - ReadOnlySpan<Char>
 
一个包含字符的范围,这些字符表示定义可接受的 destination 格式的标准或自定义格式字符串。
- provider
 - IFormatProvider
 
一个可选对象,提供有关 destination 的区域性特定格式设置信息。
返回
如果格式设置成功,则为 true;否则为 false。