Beispiel #1
0
 public static bool TryFormat(DateTimeOffset value, Span <byte> buffer, out int bytesWritten, ParsedFormat format = default, SymbolTable symbolTable = null)
 {
     if (symbolTable == null || symbolTable == SymbolTable.InvariantUtf8)
     {
         return(Utf8.TryFormat(value, buffer, out bytesWritten, format));
     }
     else if (symbolTable == SymbolTable.InvariantUtf16)
     {
         return(Utf16.TryFormat(value, buffer, out bytesWritten, format));
     }
     else
     {
         throw new NotSupportedException();
     }
 }
Beispiel #2
0
        public static bool TryFormat(byte value, Span <byte> buffer, out int bytesWritten, ParsedFormat format = default, SymbolTable symbolTable = null)
        {
            if (format.IsDefault)
            {
                format = 'G';
            }

            if (symbolTable == null || symbolTable == SymbolTable.InvariantUtf8)
            {
                return(Utf8.TryFormat(value, buffer, out bytesWritten, format));
            }
            else if (symbolTable == SymbolTable.InvariantUtf16)
            {
                return(Utf16.TryFormat(value, buffer, out bytesWritten, format));
            }
            else
            {
                return(TryFormatUInt64(value, buffer, out bytesWritten, format, symbolTable));
            }
        }