示例#1
0
 public static void EmptyBuilder()
 {
     using var builder = new BufferWriterSlim <int>();
     Equal(0, builder.Capacity);
     builder.Add(10);
     Equal(1, builder.WrittenCount);
     Equal(10, builder[0]);
 }
示例#2
0
        public string BuildStringOnStackNoPreallocatedBuffer()
        {
            var writer = new BufferWriterSlim <char>();

            try
            {
                for (var i = 0; i < 100; i++)
                {
                    writer.Write(StringValue);
                    writer.WriteInt32(int.MaxValue);
                    writer.WriteLine();
                }

                return(writer.ToString());
            }
            finally
            {
                writer.Dispose();
            }
        }
示例#3
0
 private static unsafe void Write <T>(ref BufferWriterSlim <byte> builder, delegate * < Span <byte>, T, void > encoder, T value)