コード例 #1
0
        public static bool TryFormat(float value, Span <byte> buffer, out int bytesWritten, ParsedFormat format = default, SymbolTable symbolTable = null)
        {
            if (format.IsDefault)
            {
                format = 'G';
            }

            symbolTable = symbolTable ?? SymbolTable.InvariantUtf8;

            switch (format.Symbol)
            {
            case 'G':
                return(CustomFormatter.TryFormatNumber(value, true, buffer, out bytesWritten, format, symbolTable));

            default:
                throw new NotSupportedException();
            }
        }
コード例 #2
0
ファイル: Utf16Formatter.cs プロジェクト: scslmd/corefxlab
 /// <summary>
 ///
 /// </summary>
 /// <param name="value"></param>
 /// <param name="buffer"></param>
 /// <param name="bytesWritten"></param>
 /// <param name="format">only 'G' format is supported</param>
 /// <returns></returns>
 public static bool TryFormat(float value, Span <byte> buffer, out int bytesWritten, StandardFormat format = default)
 => CustomFormatter.TryFormat(value, buffer, out bytesWritten, format, SymbolTable.InvariantUtf8);