示例#1
0
 public static bool TryFormat(Guid value, Span <byte> buffer, out int bytesWritten, ParsedFormat format = default, SymbolTable symbolTable = null)
 {
     if (symbolTable == null || symbolTable == SymbolTable.InvariantUtf8)
     {
         return(Utf8Formatter.TryFormat(value, buffer, out bytesWritten, format));
     }
     else if (symbolTable == SymbolTable.InvariantUtf16)
     {
         return(Utf16Formatter.TryFormat(value, buffer, out bytesWritten, format));
     }
     else
     {
         throw new NotSupportedException();
     }
 }
示例#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(Utf8Formatter.TryFormat(value, buffer, out bytesWritten, format));
            }
            else if (symbolTable == SymbolTable.InvariantUtf16)
            {
                return(Utf16Formatter.TryFormat(value, buffer, out bytesWritten, format));
            }
            else
            {
                return(TryFormatUInt64(value, buffer, out bytesWritten, format, symbolTable));
            }
        }