Utf8Formatter.TryFormat Método
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Sobrecargas
TryFormat(Boolean, Span<Byte>, Int32, StandardFormat)
- Source:
- Utf8Formatter.Boolean.cs
- Source:
- Utf8Formatter.Boolean.cs
- Source:
- Utf8Formatter.Boolean.cs
- Source:
- Utf8Formatter.Boolean.cs
- Source:
- Utf8Formatter.Boolean.cs
Boolean Da formato a como una cadena UTF8.
public static bool TryFormat(bool value, Span<byte> destination, out int bytesWritten, System.Buffers.StandardFormat format = default);
static member TryFormat : bool * Span<byte> * int * System.Buffers.StandardFormat -> bool
Public Shared Function TryFormat (value As Boolean, destination As Span(Of Byte), ByRef bytesWritten As Integer, Optional format As StandardFormat = Nothing) As Boolean
Parámetros
- value
- Boolean
Valor al que se va a dar formato.
- bytesWritten
- Int32
Cuando el método devuelve, contiene la longitud del texto con formato en bytes.
- format
- StandardFormat
Formato estándar que se va a usar.
Devoluciones
true si la operación de formato se realiza correctamente; false si destination es demasiado pequeño.
Comentarios
Formatos admitidos:
| Cadena de formato | Cadena de resultado de ejemplo |
|---|---|
| G (valor predeterminado) | Verdadero/Falso |
| l | true/false |
Si se produce un error en el método, aumente iterativamente el tamaño del búfer y vuelva a intentarlo hasta que se realice correctamente.
Se aplica a
TryFormat(Byte, Span<Byte>, Int32, StandardFormat)
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
Byte Da formato a como una cadena UTF8.
public static bool TryFormat(byte value, Span<byte> destination, out int bytesWritten, System.Buffers.StandardFormat format = default);
static member TryFormat : byte * Span<byte> * int * System.Buffers.StandardFormat -> bool
Public Shared Function TryFormat (value As Byte, destination As Span(Of Byte), ByRef bytesWritten As Integer, Optional format As StandardFormat = Nothing) As Boolean
Parámetros
- value
- Byte
Valor al que se va a dar formato.
- bytesWritten
- Int32
Cuando el método devuelve, contiene la longitud del texto con formato en bytes.
- format
- StandardFormat
Formato estándar que se va a usar.
Devoluciones
true si la operación de formato se realiza correctamente; false si destination es demasiado pequeño.
Comentarios
Formatos admitidos:
| Cadena de formato | Cadena de resultado de ejemplo |
|---|---|
| G/g (valor predeterminado) | |
| D/d | 122 |
| N/n | 122 |
| X/x | 7a |
Si se produce un error en el método, aumente iterativamente el tamaño del búfer y vuelva a intentarlo hasta que se realice correctamente.
Se aplica a
TryFormat(DateTime, Span<Byte>, Int32, StandardFormat)
- Source:
- Utf8Formatter.Date.cs
- Source:
- Utf8Formatter.Date.cs
- Source:
- Utf8Formatter.Date.cs
- Source:
- Utf8Formatter.Date.cs
- Source:
- Utf8Formatter.Date.cs
DateTime Da formato a como una cadena UTF8.
public static bool TryFormat(DateTime value, Span<byte> destination, out int bytesWritten, System.Buffers.StandardFormat format = default);
static member TryFormat : DateTime * Span<byte> * int * System.Buffers.StandardFormat -> bool
Public Shared Function TryFormat (value As DateTime, destination As Span(Of Byte), ByRef bytesWritten As Integer, Optional format As StandardFormat = Nothing) As Boolean
Parámetros
- value
- DateTime
Valor al que se va a dar formato.
- bytesWritten
- Int32
Cuando el método devuelve, contiene la longitud del texto con formato en bytes.
- format
- StandardFormat
Formato estándar que se va a usar.
Devoluciones
true si la operación de formato se realiza correctamente; false si destination es demasiado pequeño.
Comentarios
Formatos admitidos:
| Cadena de formato | Cadena de resultado de ejemplo | Comentarios |
|---|---|---|
| G (valor predeterminado) | 05/25/2017 10:30:15 | |
| R | Tue, 03 ene 2017 08:08:05 GMT | (RFC 1123) |
| l | tue, 03 ene 2017 08:08:05 gmt | (RFC 1123 en minúsculas) |
| O | 2017-06-12T05:30:45.7680000-07:00 | (Recorrido de ida y vuelta) |
Si se produce un error en el método, aumente iterativamente el tamaño del búfer y vuelva a intentarlo hasta que se realice correctamente.
Se aplica a
TryFormat(DateTimeOffset, Span<Byte>, Int32, StandardFormat)
- Source:
- Utf8Formatter.Date.cs
- Source:
- Utf8Formatter.Date.cs
- Source:
- Utf8Formatter.Date.cs
- Source:
- Utf8Formatter.Date.cs
- Source:
- Utf8Formatter.Date.cs
DateTimeOffset Da formato a como una cadena UTF8.
public static bool TryFormat(DateTimeOffset value, Span<byte> destination, out int bytesWritten, System.Buffers.StandardFormat format = default);
static member TryFormat : DateTimeOffset * Span<byte> * int * System.Buffers.StandardFormat -> bool
Public Shared Function TryFormat (value As DateTimeOffset, destination As Span(Of Byte), ByRef bytesWritten As Integer, Optional format As StandardFormat = Nothing) As Boolean
Parámetros
- value
- DateTimeOffset
Valor al que se va a dar formato.
- bytesWritten
- Int32
Cuando el método devuelve, contiene la longitud del texto con formato en bytes.
- format
- StandardFormat
Formato estándar que se va a usar.
Devoluciones
true si la operación de formato se realiza correctamente; false si destination es demasiado pequeño.
Se aplica a
TryFormat(Decimal, Span<Byte>, Int32, StandardFormat)
- Source:
- Utf8Formatter.Decimal.cs
- Source:
- Utf8Formatter.Decimal.cs
- Source:
- Utf8Formatter.Decimal.cs
- Source:
- Utf8Formatter.Decimal.cs
- Source:
- Utf8Formatter.Decimal.cs
Decimal Da formato a como una cadena UTF8.
public static bool TryFormat(decimal value, Span<byte> destination, out int bytesWritten, System.Buffers.StandardFormat format = default);
static member TryFormat : decimal * Span<byte> * int * System.Buffers.StandardFormat -> bool
Public Shared Function TryFormat (value As Decimal, destination As Span(Of Byte), ByRef bytesWritten As Integer, Optional format As StandardFormat = Nothing) As Boolean
Parámetros
- value
- Decimal
Valor al que se va a dar formato.
- bytesWritten
- Int32
Cuando el método devuelve, contiene la longitud del texto con formato en bytes.
- format
- StandardFormat
Formato estándar que se va a usar.
Devoluciones
true si la operación de formato se realiza correctamente; false si destination es demasiado pequeño.
Comentarios
Formatos admitidos:
| Cadena de formato | Cadena de resultado de ejemplo | Comentarios |
|---|---|---|
| G/g (valor predeterminado) | ||
| F/f | 12.45 | Punto fijo |
| E/e | 1.245000e1 | Exponencial |
Si se produce un error en el método, aumente iterativamente el tamaño del búfer y vuelva a intentarlo hasta que se realice correctamente.
Se aplica a
TryFormat(Double, Span<Byte>, Int32, StandardFormat)
- Source:
- Utf8Formatter.Float.cs
- Source:
- Utf8Formatter.Float.cs
- Source:
- Utf8Formatter.Float.cs
- Source:
- Utf8Formatter.Float.cs
- Source:
- Utf8Formatter.Float.cs
Double Da formato a como una cadena UTF8.
public static bool TryFormat(double value, Span<byte> destination, out int bytesWritten, System.Buffers.StandardFormat format = default);
static member TryFormat : double * Span<byte> * int * System.Buffers.StandardFormat -> bool
Public Shared Function TryFormat (value As Double, destination As Span(Of Byte), ByRef bytesWritten As Integer, Optional format As StandardFormat = Nothing) As Boolean
Parámetros
- value
- Double
Valor al que se va a dar formato.
- bytesWritten
- Int32
Cuando el método devuelve, contiene la longitud del texto con formato en bytes.
- format
- StandardFormat
Formato estándar que se va a usar.
Devoluciones
true si la operación de formato se realiza correctamente; false si destination es demasiado pequeño.
Comentarios
Formatos admitidos:
| Cadena de formato | Cadena de resultado de ejemplo | Comentarios |
|---|---|---|
| G/g (valor predeterminado) | ||
| F/f | 12.45 | Punto fijo |
| E/e | 1.245000e1 | Exponencial |
Si se produce un error en el método, aumente iterativamente el tamaño del búfer y vuelva a intentarlo hasta que se realice correctamente.
Se aplica a
TryFormat(Guid, Span<Byte>, Int32, StandardFormat)
- Source:
- Utf8Formatter.Guid.cs
- Source:
- Utf8Formatter.Guid.cs
- Source:
- Utf8Formatter.Guid.cs
- Source:
- Utf8Formatter.Guid.cs
- Source:
- Utf8Formatter.Guid.cs
Guid Da formato a como una cadena UTF8.
public static bool TryFormat(Guid value, Span<byte> destination, out int bytesWritten, System.Buffers.StandardFormat format = default);
static member TryFormat : Guid * Span<byte> * int * System.Buffers.StandardFormat -> bool
Public Shared Function TryFormat (value As Guid, destination As Span(Of Byte), ByRef bytesWritten As Integer, Optional format As StandardFormat = Nothing) As Boolean
Parámetros
- value
- Guid
Valor al que se va a dar formato.
- bytesWritten
- Int32
Cuando el método devuelve, contiene la longitud del texto con formato en bytes.
- format
- StandardFormat
Formato estándar que se va a usar.
Devoluciones
true si la operación de formato se realiza correctamente; false si destination es demasiado pequeño.
Comentarios
Formatos admitidos:
| Cadena de formato | Cadena de resultado |
|---|---|
| D (valor predeterminado) | nnn-nnnn-nn-n-nn-n |
| B | {nnn-nn-n-nnnn-nn-nnn} |
| P | (nnn-nn-n-nnnn-nn-n) |
| S | nnn |
Si se produce un error en el método, aumente iterativamente el tamaño del búfer y vuelva a intentarlo hasta que se realice correctamente.
Se aplica a
TryFormat(Int16, Span<Byte>, Int32, StandardFormat)
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
Int16 Da formato a como una cadena UTF8.
public static bool TryFormat(short value, Span<byte> destination, out int bytesWritten, System.Buffers.StandardFormat format = default);
static member TryFormat : int16 * Span<byte> * int * System.Buffers.StandardFormat -> bool
Public Shared Function TryFormat (value As Short, destination As Span(Of Byte), ByRef bytesWritten As Integer, Optional format As StandardFormat = Nothing) As Boolean
Parámetros
- value
- Int16
Valor al que se va a dar formato.
- bytesWritten
- Int32
Cuando el método devuelve, contiene la longitud del texto con formato en bytes.
- format
- StandardFormat
Formato estándar que se va a usar.
Devoluciones
true si la operación de formato se realiza correctamente; false si destination es demasiado pequeño.
Comentarios
Formatos admitidos:
| Cadena de formato | Cadena de resultado de ejemplo |
|---|---|
| G/g (valor predeterminado) | |
| D/d | 32767 |
| N/n | 32,767 |
| X/x | 7fff |
Si se produce un error en el método, aumente iterativamente el tamaño del búfer y vuelva a intentarlo hasta que se realice correctamente.
Se aplica a
TryFormat(Int32, Span<Byte>, Int32, StandardFormat)
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
Int32 Da formato a como una cadena UTF8.
public static bool TryFormat(int value, Span<byte> destination, out int bytesWritten, System.Buffers.StandardFormat format = default);
static member TryFormat : int * Span<byte> * int * System.Buffers.StandardFormat -> bool
Public Shared Function TryFormat (value As Integer, destination As Span(Of Byte), ByRef bytesWritten As Integer, Optional format As StandardFormat = Nothing) As Boolean
Parámetros
- value
- Int32
Valor al que se va a dar formato.
- bytesWritten
- Int32
Cuando el método devuelve, contiene la longitud del texto con formato en bytes.
- format
- StandardFormat
Formato estándar que se va a usar.
Devoluciones
true si la operación de formato se realiza correctamente; false si destination es demasiado pequeño.
Comentarios
Formatos admitidos:
| Cadena de formato | Cadena de resultado de ejemplo |
|---|---|
| G/g (valor predeterminado) | |
| D/d | 32767 |
| N/n | 32,767 |
| X/x | 7fff |
Si se produce un error en el método, aumente iterativamente el tamaño del búfer y vuelva a intentarlo hasta que se realice correctamente.
Se aplica a
TryFormat(Int64, Span<Byte>, Int32, StandardFormat)
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
Int64 Da formato a como una cadena UTF8.
public static bool TryFormat(long value, Span<byte> destination, out int bytesWritten, System.Buffers.StandardFormat format = default);
static member TryFormat : int64 * Span<byte> * int * System.Buffers.StandardFormat -> bool
Public Shared Function TryFormat (value As Long, destination As Span(Of Byte), ByRef bytesWritten As Integer, Optional format As StandardFormat = Nothing) As Boolean
Parámetros
- value
- Int64
Valor al que se va a dar formato.
- bytesWritten
- Int32
Cuando el método devuelve, contiene la longitud del texto con formato en bytes.
- format
- StandardFormat
Formato estándar que se va a usar.
Devoluciones
true si la operación de formato se realiza correctamente; false si destination es demasiado pequeño.
Comentarios
Formatos admitidos:
| Cadena de formato | Cadena de resultado de ejemplo |
|---|---|
| G/g (valor predeterminado) | |
| D/d | 32767 |
| N/n | 32,767 |
| X/x | 7fff |
Si se produce un error en el método, aumente iterativamente el tamaño del búfer y vuelva a intentarlo hasta que se realice correctamente.
Se aplica a
TryFormat(SByte, Span<Byte>, Int32, StandardFormat)
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
Importante
Esta API no es conforme a CLS.
SByte Da formato a como una cadena UTF8.
[System.CLSCompliant(false)]
public static bool TryFormat(sbyte value, Span<byte> destination, out int bytesWritten, System.Buffers.StandardFormat format = default);
[<System.CLSCompliant(false)>]
static member TryFormat : sbyte * Span<byte> * int * System.Buffers.StandardFormat -> bool
Public Shared Function TryFormat (value As SByte, destination As Span(Of Byte), ByRef bytesWritten As Integer, Optional format As StandardFormat = Nothing) As Boolean
Parámetros
- value
- SByte
Valor al que se va a dar formato.
- bytesWritten
- Int32
Cuando el método devuelve, contiene la longitud del texto con formato en bytes.
- format
- StandardFormat
Formato estándar que se va a usar.
Devoluciones
true si la operación de formato se realiza correctamente; false si destination es demasiado pequeño.
- Atributos
Comentarios
Formatos admitidos:
| Cadena de formato | Cadena de resultado de ejemplo |
|---|---|
| G/g (valor predeterminado) | |
| D/d | 122 |
| N/n | 122 |
| X/x | 7a |
Si se produce un error en el método, aumente iterativamente el tamaño del búfer y vuelva a intentarlo hasta que se realice correctamente.
Se aplica a
TryFormat(Single, Span<Byte>, Int32, StandardFormat)
- Source:
- Utf8Formatter.Float.cs
- Source:
- Utf8Formatter.Float.cs
- Source:
- Utf8Formatter.Float.cs
- Source:
- Utf8Formatter.Float.cs
- Source:
- Utf8Formatter.Float.cs
Single Da formato a como una cadena UTF8.
public static bool TryFormat(float value, Span<byte> destination, out int bytesWritten, System.Buffers.StandardFormat format = default);
static member TryFormat : single * Span<byte> * int * System.Buffers.StandardFormat -> bool
Public Shared Function TryFormat (value As Single, destination As Span(Of Byte), ByRef bytesWritten As Integer, Optional format As StandardFormat = Nothing) As Boolean
Parámetros
- value
- Single
Valor al que se va a dar formato.
- bytesWritten
- Int32
Cuando el método devuelve, contiene la longitud del texto con formato en bytes.
- format
- StandardFormat
Formato estándar que se va a usar.
Devoluciones
true si la operación de formato se realiza correctamente; false si destination es demasiado pequeño.
Comentarios
Formatos admitidos:
| Cadena de formato | Cadena de resultado de ejemplo | Comentarios |
|---|---|---|
| G/g (valor predeterminado) | ||
| F/f | 12.45 | Punto fijo |
| E/e | 1.245000e1 | Exponencial |
Si se produce un error en el método, aumente iterativamente el tamaño del búfer y vuelva a intentarlo hasta que se realice correctamente.
Se aplica a
TryFormat(TimeSpan, Span<Byte>, Int32, StandardFormat)
- Source:
- Utf8Formatter.TimeSpan.cs
- Source:
- Utf8Formatter.TimeSpan.cs
- Source:
- Utf8Formatter.TimeSpan.cs
- Source:
- Utf8Formatter.TimeSpan.cs
- Source:
- Utf8Formatter.TimeSpan.cs
TimeSpan Da formato a como una cadena UTF8.
public static bool TryFormat(TimeSpan value, Span<byte> destination, out int bytesWritten, System.Buffers.StandardFormat format = default);
static member TryFormat : TimeSpan * Span<byte> * int * System.Buffers.StandardFormat -> bool
Public Shared Function TryFormat (value As TimeSpan, destination As Span(Of Byte), ByRef bytesWritten As Integer, Optional format As StandardFormat = Nothing) As Boolean
Parámetros
- value
- TimeSpan
Valor al que se va a dar formato.
- bytesWritten
- Int32
Cuando el método devuelve, contiene la longitud del texto con formato en bytes.
- format
- StandardFormat
Formato estándar que se va a usar.
Devoluciones
true si la operación de formato se realiza correctamente; false si destination es demasiado pequeño.
Comentarios
Formatos admitidos:
| Cadena de formato | Cadena de resultado | Comentarios |
|---|---|---|
| c/t/T (valor predeterminado) | [-][d.]hh:mm:ss[.fffffff] | (formato constante) |
| G | ]:d:hh:mm:ss.fffffff | (general long) |
| g | [-][d:][h]h:mm:ss[.f[f[f[f[f[f[f]]]]]] | (general short) |
Si se produce un error en el método, aumente iterativamente el tamaño del búfer y vuelva a intentarlo hasta que se realice correctamente.
Se aplica a
TryFormat(UInt16, Span<Byte>, Int32, StandardFormat)
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
Importante
Esta API no es conforme a CLS.
UInt16 Da formato a como una cadena UTF8.
[System.CLSCompliant(false)]
public static bool TryFormat(ushort value, Span<byte> destination, out int bytesWritten, System.Buffers.StandardFormat format = default);
[<System.CLSCompliant(false)>]
static member TryFormat : uint16 * Span<byte> * int * System.Buffers.StandardFormat -> bool
Public Shared Function TryFormat (value As UShort, destination As Span(Of Byte), ByRef bytesWritten As Integer, Optional format As StandardFormat = Nothing) As Boolean
Parámetros
- value
- UInt16
Valor al que se va a dar formato.
- bytesWritten
- Int32
Cuando el método devuelve, contiene la longitud del texto con formato en bytes.
- format
- StandardFormat
Formato estándar que se va a usar.
Devoluciones
true si la operación de formato se realiza correctamente; false si destination es demasiado pequeño.
- Atributos
Comentarios
Formatos admitidos:
| Cadena de formato | Cadena de resultado de ejemplo |
|---|---|
| G/g (valor predeterminado) | |
| D/d | 32767 |
| N/n | 32,767 |
| X/x | 7fff |
Si se produce un error en el método, aumente iterativamente el tamaño del búfer y vuelva a intentarlo hasta que se realice correctamente.
Se aplica a
TryFormat(UInt32, Span<Byte>, Int32, StandardFormat)
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
Importante
Esta API no es conforme a CLS.
UInt32 Da formato a como una cadena UTF8.
[System.CLSCompliant(false)]
public static bool TryFormat(uint value, Span<byte> destination, out int bytesWritten, System.Buffers.StandardFormat format = default);
[<System.CLSCompliant(false)>]
static member TryFormat : uint32 * Span<byte> * int * System.Buffers.StandardFormat -> bool
Public Shared Function TryFormat (value As UInteger, destination As Span(Of Byte), ByRef bytesWritten As Integer, Optional format As StandardFormat = Nothing) As Boolean
Parámetros
- value
- UInt32
Valor al que se va a dar formato.
- bytesWritten
- Int32
Cuando el método devuelve, contiene la longitud del texto con formato en bytes.
- format
- StandardFormat
Formato estándar que se va a usar.
Devoluciones
true si la operación de formato se realiza correctamente; false si destination es demasiado pequeño.
- Atributos
Comentarios
Formatos admitidos:
| Cadena de formato | Cadena de resultado de ejemplo |
|---|---|
| G/g (valor predeterminado) | |
| D/d | 32767 |
| N/n | 32,767 |
| X/x | 7fff |
Si se produce un error en el método, aumente iterativamente el tamaño del búfer y vuelva a intentarlo hasta que se realice correctamente.
Se aplica a
TryFormat(UInt64, Span<Byte>, Int32, StandardFormat)
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
- Source:
- Utf8Formatter.Integer.cs
Importante
Esta API no es conforme a CLS.
UInt64 Da formato a como una cadena UTF8.
[System.CLSCompliant(false)]
public static bool TryFormat(ulong value, Span<byte> destination, out int bytesWritten, System.Buffers.StandardFormat format = default);
[<System.CLSCompliant(false)>]
static member TryFormat : uint64 * Span<byte> * int * System.Buffers.StandardFormat -> bool
Public Shared Function TryFormat (value As ULong, destination As Span(Of Byte), ByRef bytesWritten As Integer, Optional format As StandardFormat = Nothing) As Boolean
Parámetros
- value
- UInt64
Valor al que se va a dar formato.
- bytesWritten
- Int32
Cuando el método devuelve, contiene la longitud del texto con formato en bytes.
- format
- StandardFormat
Formato estándar que se va a usar.
Devoluciones
true si la operación de formato se realiza correctamente; false si destination es demasiado pequeño.
- Atributos
Comentarios
Formatos admitidos:
| Cadena de formato | Cadena de resultado de ejemplo |
|---|---|
| G/g (valor predeterminado) | |
| D/d | 32767 |
| N/n | 32,767 |
| X/x | 7fff |
Si se produce un error en el método, aumente iterativamente el tamaño del búfer y vuelva a intentarlo hasta que se realice correctamente.