示例#1
0
        static bool TryFormatDateTimeFormatG(DateTime value, TimeSpan offset, Span <byte> buffer, out int bytesWritten, SymbolTable symbolTable)
        {
            // for now it only works for invariant culture
            if (symbolTable == SymbolTable.InvariantUtf8)
            {
                return(InvariantUtf8TimeFormatter.TryFormatG(value, offset, buffer, out bytesWritten));
            }
            else if (symbolTable == SymbolTable.InvariantUtf16)
            {
                return(InvariantUtf16TimeFormatter.TryFormatG(value, offset, buffer, out bytesWritten));
            }

            ThrowNotImplemented();
            bytesWritten = 0;
            return(false);
        }
 static bool TryFormatDateTimeFormatG(DateTime value, TimeSpan offset, Span <byte> buffer, out int bytesWritten, TextEncoder encoder)
 {
     // for now it only works for invariant culture
     if (encoder.IsInvariantUtf8)
     {
         return(InvariantUtf8TimeFormatter.TryFormatG(value, offset, buffer, out bytesWritten));
     }
     else if (encoder.IsInvariantUtf16)
     {
         return(InvariantUtf16TimeFormatter.TryFormatG(value, offset, buffer, out bytesWritten));
     }
     else
     {
         throw new NotImplementedException();
     }
 }