Condividi tramite


Utf8Formatter.TryFormat Metodo

Definizione

Overload

TryFormat(Boolean, Span<Byte>, Int32, StandardFormat)

Formatta un elemento Boolean come stringa UTF8.

TryFormat(Byte, Span<Byte>, Int32, StandardFormat)

Formatta un elemento Byte come stringa UTF8.

TryFormat(DateTime, Span<Byte>, Int32, StandardFormat)

Formatta un elemento DateTime come stringa UTF8.

TryFormat(DateTimeOffset, Span<Byte>, Int32, StandardFormat)

Formatta un elemento DateTimeOffset come stringa UTF8.

TryFormat(Decimal, Span<Byte>, Int32, StandardFormat)

Formatta un elemento Decimal come stringa UTF8.

TryFormat(Double, Span<Byte>, Int32, StandardFormat)

Formatta un elemento Double come stringa UTF8.

TryFormat(Guid, Span<Byte>, Int32, StandardFormat)

Formatta un elemento Guid come stringa UTF8.

TryFormat(Int16, Span<Byte>, Int32, StandardFormat)

Formatta un elemento Int16 come stringa UTF8.

TryFormat(Int32, Span<Byte>, Int32, StandardFormat)

Formatta un elemento Int32 come stringa UTF8.

TryFormat(Int64, Span<Byte>, Int32, StandardFormat)

Formatta un elemento Int64 come stringa UTF8.

TryFormat(SByte, Span<Byte>, Int32, StandardFormat)

Formatta un elemento SByte come stringa UTF8.

TryFormat(Single, Span<Byte>, Int32, StandardFormat)

Formatta un elemento Single come stringa UTF8.

TryFormat(TimeSpan, Span<Byte>, Int32, StandardFormat)

Formatta un elemento TimeSpan come stringa UTF8.

TryFormat(UInt16, Span<Byte>, Int32, StandardFormat)

Formatta un elemento UInt16 come stringa UTF8.

TryFormat(UInt32, Span<Byte>, Int32, StandardFormat)

Formatta un elemento UInt32 come stringa UTF8.

TryFormat(UInt64, Span<Byte>, Int32, StandardFormat)

Formatta un elemento UInt64 come stringa UTF8.

TryFormat(Boolean, Span<Byte>, Int32, StandardFormat)

Source:
Utf8Formatter.Boolean.cs
Source:
Utf8Formatter.Boolean.cs
Source:
Utf8Formatter.Boolean.cs

Formatta un elemento Boolean come stringa 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

Parametri

value
Boolean

Valore da formattare.

destination
Span<Byte>

Buffer in cui scrivere il valore in formato UTF8.

bytesWritten
Int32

Quando il metodo restituisce un risultato, contiene la lunghezza del testo formattato in byte.

format
StandardFormat

Il formato standard da usare.

Restituisce

true se l'operazione di formattazione ha esito positivo, false se destination è troppo piccolo.

Commenti

Formati supportati:

Stringa di formato Stringa di risultato di esempio
G (impostazione predefinita) True/False
l true/false

Se il metodo ha esito negativo, aumentare in modo iterativo le dimensioni del buffer e riprovare fino a quando non riesce.

Si applica a

TryFormat(Byte, Span<Byte>, Int32, StandardFormat)

Source:
Utf8Formatter.Integer.cs
Source:
Utf8Formatter.Integer.cs
Source:
Utf8Formatter.Integer.cs

Formatta un elemento Byte come stringa 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

Parametri

value
Byte

Valore da formattare.

destination
Span<Byte>

Buffer in cui scrivere il valore in formato UTF8.

bytesWritten
Int32

Quando il metodo restituisce un risultato, contiene la lunghezza del testo formattato in byte.

format
StandardFormat

Il formato standard da usare.

Restituisce

true se l'operazione di formattazione ha esito positivo, false se destination è troppo piccolo.

Commenti

Formati supportati:

Stringa di formato Stringa di risultato di esempio
G/g (impostazione predefinita)
D/d 122
N/n 122
X/x 7a

Se il metodo ha esito negativo, aumentare in modo iterativo le dimensioni del buffer e riprovare fino a quando non riesce.

Si applica a

TryFormat(DateTime, Span<Byte>, Int32, StandardFormat)

Source:
Utf8Formatter.Date.cs
Source:
Utf8Formatter.Date.cs
Source:
Utf8Formatter.Date.cs

Formatta un elemento DateTime come stringa 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

Parametri

value
DateTime

Valore da formattare.

destination
Span<Byte>

Buffer in cui scrivere il valore in formato UTF8.

bytesWritten
Int32

Quando il metodo restituisce un risultato, contiene la lunghezza del testo formattato in byte.

format
StandardFormat

Il formato standard da usare.

Restituisce

true se l'operazione di formattazione ha esito positivo, false se destination è troppo piccolo.

Commenti

Formati supportati:

Stringa di formato Stringa di risultato di esempio Commenti
G (impostazione predefinita) 05/25/2017 10:30:15
R Mar, 03 Jan 2017 08:08:05 GMT (RFC 1123)
l tue, 03 gennaio 2017 08:08:05 gmt (RFC minuscolo 1123)
O 2017-06-12T12:30:45.768+00:00 (Round trippable)

Se il metodo ha esito negativo, aumentare in modo iterativo le dimensioni del buffer e riprovare fino a quando non riesce.

Si applica a

TryFormat(DateTimeOffset, Span<Byte>, Int32, StandardFormat)

Source:
Utf8Formatter.Date.cs
Source:
Utf8Formatter.Date.cs
Source:
Utf8Formatter.Date.cs

Formatta un elemento DateTimeOffset come stringa 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

Parametri

value
DateTimeOffset

Valore da formattare.

destination
Span<Byte>

Buffer in cui scrivere il valore in formato UTF8.

bytesWritten
Int32

Quando il metodo restituisce un risultato, contiene la lunghezza del testo formattato in byte.

format
StandardFormat

Il formato standard da usare.

Restituisce

true se l'operazione di formattazione ha esito positivo, false se destination è troppo piccolo.

Si applica a

TryFormat(Decimal, Span<Byte>, Int32, StandardFormat)

Source:
Utf8Formatter.Decimal.cs
Source:
Utf8Formatter.Decimal.cs
Source:
Utf8Formatter.Decimal.cs

Formatta un elemento Decimal come stringa 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

Parametri

value
Decimal

Valore da formattare.

destination
Span<Byte>

Buffer in cui scrivere il valore in formato UTF8.

bytesWritten
Int32

Quando il metodo restituisce un risultato, contiene la lunghezza del testo formattato in byte.

format
StandardFormat

Il formato standard da usare.

Restituisce

true se l'operazione di formattazione ha esito positivo, false se destination è troppo piccolo.

Commenti

Formati supportati:

Stringa di formato Stringa di risultato di esempio Commenti
G/g (impostazione predefinita)
F/f 12.45 Punto fisso
E/e 1.245000e1 Esponenziale

Se il metodo ha esito negativo, aumentare in modo iterativo le dimensioni del buffer e riprovare fino a quando non riesce.

Si applica a

TryFormat(Double, Span<Byte>, Int32, StandardFormat)

Source:
Utf8Formatter.Float.cs
Source:
Utf8Formatter.Float.cs
Source:
Utf8Formatter.Float.cs

Formatta un elemento Double come stringa 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

Parametri

value
Double

Valore da formattare.

destination
Span<Byte>

Buffer in cui scrivere il valore in formato UTF8.

bytesWritten
Int32

Quando il metodo restituisce un risultato, contiene la lunghezza del testo formattato in byte.

format
StandardFormat

Il formato standard da usare.

Restituisce

true se l'operazione di formattazione ha esito positivo, false se destination è troppo piccolo.

Commenti

Formati supportati:

Stringa di formato Stringa di risultato di esempio Commenti
G/g (impostazione predefinita)
F/f 12.45 Punto fisso
E/e 1.245000e1 Esponenziale

Se il metodo ha esito negativo, aumentare in modo iterativo le dimensioni del buffer e riprovare fino a quando non riesce.

Si applica a

TryFormat(Guid, Span<Byte>, Int32, StandardFormat)

Source:
Utf8Formatter.Guid.cs
Source:
Utf8Formatter.Guid.cs
Source:
Utf8Formatter.Guid.cs

Formatta un elemento Guid come stringa 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

Parametri

value
Guid

Valore da formattare.

destination
Span<Byte>

Buffer in cui scrivere il valore in formato UTF8.

bytesWritten
Int32

Quando il metodo restituisce un risultato, contiene la lunghezza del testo formattato in byte.

format
StandardFormat

Il formato standard da usare.

Restituisce

true se l'operazione di formattazione ha esito positivo, false se destination è troppo piccolo.

Commenti

Formati supportati:

Stringa di formato Stringa di risultato
D (impostazione predefinita) nnnnnn-nnnn-nnnn-nnnn-nnnn-nnnnnnnn
b {nnnnnn-nnnn-nnnn-nnnn-nnnn-nnnnnnnnnn}
P (nnnnnn-nnnn-nnnn-nnnn-nnnn-nnnnnnnn)
N nnnnnnnn

Se il metodo ha esito negativo, aumentare in modo iterativo le dimensioni del buffer e riprovare fino a quando non riesce.

Si applica a

TryFormat(Int16, Span<Byte>, Int32, StandardFormat)

Source:
Utf8Formatter.Integer.cs
Source:
Utf8Formatter.Integer.cs
Source:
Utf8Formatter.Integer.cs

Formatta un elemento Int16 come stringa 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

Parametri

value
Int16

Valore da formattare.

destination
Span<Byte>

Buffer in cui scrivere il valore in formato UTF8.

bytesWritten
Int32

Quando il metodo restituisce un risultato, contiene la lunghezza del testo formattato in byte.

format
StandardFormat

Il formato standard da usare.

Restituisce

true se l'operazione di formattazione ha esito positivo, false se destination è troppo piccolo.

Commenti

Formati supportati:

Stringa di formato Stringa di risultato di esempio
G/g (impostazione predefinita)
D/d 32767
N/n 32.767
X/x 7fff

Se il metodo ha esito negativo, aumentare in modo iterativo le dimensioni del buffer e riprovare fino a quando non riesce.

Si applica a

TryFormat(Int32, Span<Byte>, Int32, StandardFormat)

Source:
Utf8Formatter.Integer.cs
Source:
Utf8Formatter.Integer.cs
Source:
Utf8Formatter.Integer.cs

Formatta un elemento Int32 come stringa 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

Parametri

value
Int32

Valore da formattare.

destination
Span<Byte>

Buffer in cui scrivere il valore in formato UTF8.

bytesWritten
Int32

Quando il metodo restituisce un risultato, contiene la lunghezza del testo formattato in byte.

format
StandardFormat

Il formato standard da usare.

Restituisce

true se l'operazione di formattazione ha esito positivo, false se destination è troppo piccolo.

Commenti

Formati supportati:

Stringa di formato Stringa di risultato di esempio
G/g (impostazione predefinita)
D/d 32767
N/n 32.767
X/x 7fff

Se il metodo ha esito negativo, aumentare in modo iterativo le dimensioni del buffer e riprovare fino a quando non riesce.

Si applica a

TryFormat(Int64, Span<Byte>, Int32, StandardFormat)

Source:
Utf8Formatter.Integer.cs
Source:
Utf8Formatter.Integer.cs
Source:
Utf8Formatter.Integer.cs

Formatta un elemento Int64 come stringa 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

Parametri

value
Int64

Valore da formattare.

destination
Span<Byte>

Buffer in cui scrivere il valore in formato UTF8.

bytesWritten
Int32

Quando il metodo restituisce un risultato, contiene la lunghezza del testo formattato in byte.

format
StandardFormat

Il formato standard da usare.

Restituisce

true se l'operazione di formattazione ha esito positivo, false se destination è troppo piccolo.

Commenti

Formati supportati:

Stringa di formato Stringa di risultato di esempio
G/g (impostazione predefinita)
D/d 32767
N/n 32.767
X/x 7fff

Se il metodo ha esito negativo, aumentare in modo iterativo le dimensioni del buffer e riprovare fino a quando non riesce.

Si applica a

TryFormat(SByte, Span<Byte>, Int32, StandardFormat)

Source:
Utf8Formatter.Integer.cs
Source:
Utf8Formatter.Integer.cs
Source:
Utf8Formatter.Integer.cs

Importante

Questa API non è conforme a CLS.

Formatta un elemento SByte come stringa 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

Parametri

value
SByte

Valore da formattare.

destination
Span<Byte>

Buffer in cui scrivere il valore in formato UTF8.

bytesWritten
Int32

Quando il metodo restituisce un risultato, contiene la lunghezza del testo formattato in byte.

format
StandardFormat

Il formato standard da usare.

Restituisce

true se l'operazione di formattazione ha esito positivo, false se destination è troppo piccolo.

Attributi

Commenti

Formati supportati:

Stringa di formato Stringa di risultati di esempio
G/g (impostazione predefinita)
D/d 122
N/n 122
X/x 7a

Se il metodo ha esito negativo, aumenta in modo iterativo le dimensioni del buffer e riprova fino a quando non riesce.

Si applica a

TryFormat(Single, Span<Byte>, Int32, StandardFormat)

Source:
Utf8Formatter.Float.cs
Source:
Utf8Formatter.Float.cs
Source:
Utf8Formatter.Float.cs

Formatta un elemento Single come stringa 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

Parametri

value
Single

Valore da formattare.

destination
Span<Byte>

Buffer in cui scrivere il valore in formato UTF8.

bytesWritten
Int32

Quando il metodo restituisce un risultato, contiene la lunghezza del testo formattato in byte.

format
StandardFormat

Il formato standard da usare.

Restituisce

true se l'operazione di formattazione ha esito positivo, false se destination è troppo piccolo.

Commenti

Formati supportati:

Stringa di formato Stringa di risultati di esempio Commenti
G/g (impostazione predefinita)
F/f 12.45 Punto fisso
E/e 1.245000e1 Esponenziale

Se il metodo ha esito negativo, aumenta in modo iterativo le dimensioni del buffer e riprova fino a quando non riesce.

Si applica a

TryFormat(TimeSpan, Span<Byte>, Int32, StandardFormat)

Source:
Utf8Formatter.TimeSpan.cs
Source:
Utf8Formatter.TimeSpan.cs
Source:
Utf8Formatter.TimeSpan.cs

Formatta un elemento TimeSpan come stringa 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

Parametri

value
TimeSpan

Valore da formattare.

destination
Span<Byte>

Buffer in cui scrivere il valore in formato UTF8.

bytesWritten
Int32

Quando il metodo restituisce un risultato, contiene la lunghezza del testo formattato in byte.

format
StandardFormat

Il formato standard da usare.

Restituisce

true se l'operazione di formattazione ha esito positivo, false se destination è troppo piccolo.

Commenti

Formati supportati:

Stringa di formato Stringa di risultato Commenti
c/t/T (impostazione predefinita) [-][d.]hh:mm:ss[.fffffff] (formato costante)
G [-]d:hh:mm:ss.fffffffff (lungo generale)
g [-] [d:] [h]h:mm:ss[.f[f]]]]]] (breve generale)

Se il metodo ha esito negativo, aumenta in modo iterativo le dimensioni del buffer e riprova fino a quando non riesce.

Si applica a

TryFormat(UInt16, Span<Byte>, Int32, StandardFormat)

Source:
Utf8Formatter.Integer.cs
Source:
Utf8Formatter.Integer.cs
Source:
Utf8Formatter.Integer.cs

Importante

Questa API non è conforme a CLS.

Formatta un elemento UInt16 come stringa 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

Parametri

value
UInt16

Valore da formattare.

destination
Span<Byte>

Buffer in cui scrivere il valore in formato UTF8.

bytesWritten
Int32

Quando il metodo restituisce un risultato, contiene la lunghezza del testo formattato in byte.

format
StandardFormat

Il formato standard da usare.

Restituisce

true se l'operazione di formattazione ha esito positivo, false se destination è troppo piccolo.

Attributi

Commenti

Formati supportati:

Stringa di formato Stringa di risultati di esempio
G/g (impostazione predefinita)
D/d 32767
N/n 32.767
X/x 7fff

Se il metodo ha esito negativo, aumenta in modo iterativo le dimensioni del buffer e riprova fino a quando non riesce.

Si applica a

TryFormat(UInt32, Span<Byte>, Int32, StandardFormat)

Source:
Utf8Formatter.Integer.cs
Source:
Utf8Formatter.Integer.cs
Source:
Utf8Formatter.Integer.cs

Importante

Questa API non è conforme a CLS.

Formatta un elemento UInt32 come stringa 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

Parametri

value
UInt32

Valore da formattare.

destination
Span<Byte>

Buffer in cui scrivere il valore in formato UTF8.

bytesWritten
Int32

Quando il metodo restituisce un risultato, contiene la lunghezza del testo formattato in byte.

format
StandardFormat

Il formato standard da usare.

Restituisce

true se l'operazione di formattazione ha esito positivo, false se destination è troppo piccolo.

Attributi

Commenti

Formati supportati:

Stringa di formato Stringa di risultati di esempio
G/g (impostazione predefinita)
D/d 32767
N/n 32.767
X/x 7fff

Se il metodo ha esito negativo, aumenta in modo iterativo le dimensioni del buffer e riprova fino a quando non riesce.

Si applica a

TryFormat(UInt64, Span<Byte>, Int32, StandardFormat)

Source:
Utf8Formatter.Integer.cs
Source:
Utf8Formatter.Integer.cs
Source:
Utf8Formatter.Integer.cs

Importante

Questa API non è conforme a CLS.

Formatta un elemento UInt64 come stringa 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

Parametri

value
UInt64

Valore da formattare.

destination
Span<Byte>

Buffer in cui scrivere il valore in formato UTF8.

bytesWritten
Int32

Quando il metodo restituisce un risultato, contiene la lunghezza del testo formattato in byte.

format
StandardFormat

Il formato standard da usare.

Restituisce

true se l'operazione di formattazione ha esito positivo, false se destination è troppo piccolo.

Attributi

Commenti

Formati supportati:

Stringa di formato Stringa di risultati di esempio
G/g (impostazione predefinita)
D/d 32767
N/n 32.767
X/x 7fff

Se il metodo ha esito negativo, aumenta in modo iterativo le dimensioni del buffer e riprova fino a quando non riesce.

Si applica a