Esempio n. 1
0
        static bool TryFormatDateTimeFormatO(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.TryFormatO(value, offset, buffer, out bytesWritten));
            }
            else if (symbolTable == SymbolTable.InvariantUtf16)
            {
                return(InvariantUtf16TimeFormatter.TryFormatO(value, offset, buffer, out bytesWritten));
            }

            ThrowNotImplemented();
            bytesWritten = 0;
            return(false);
        }
 static bool TryFormatDateTimeFormatO(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.TryFormatO(value, offset, buffer, out bytesWritten));
     }
     else if (encoder.IsInvariantUtf16)
     {
         return(InvariantUtf16TimeFormatter.TryFormatO(value, offset, buffer, out bytesWritten));
     }
     else
     {
         throw new NotImplementedException();
     }
 }