Exemple #1
0
        ///<inheritdoc/>
        public void Write(ZStringBuilder stringBuilder, IFormattingInfo formattingInfo)
        {
#if NETSTANDARD2_1
            output.Append(stringBuilder.AsSpan());
#else
            output.Append(stringBuilder.ToString());
#endif
        }
Exemple #2
0
        ///<inheritdoc/>
        public void Write(ZStringBuilder stringBuilder, IFormattingInfo?formattingInfo = null)
        {
#if NETSTANDARD2_1
            Output.Write(stringBuilder.AsSpan());
#else
            Output.Write(stringBuilder.ToString());
#endif
        }
        /// <summary>
        /// Creates a new instance of <see cref="ZStringBuilder"/> with the given initial capacity.
        /// </summary>
        /// <param name="capacity">The estimated capacity required. This will reduce or avoid incremental buffer increases.</param>
        internal static ZStringBuilder CreateZStringBuilder(int capacity)
        {
            var sb = new ZStringBuilder(false);

            if (capacity > DefaultBufferSize)
            {
                sb.Grow(capacity - DefaultBufferSize);
            }

            return(sb);
        }
Exemple #4
0
 ///<inheritdoc/>
 public void Write(ZStringBuilder stringBuilder, IFormattingInfo?formattingInfo = null)
 {
     Output.Append(stringBuilder);
 }
Exemple #5
0
 /// <summary>
 /// Creates a new instance of <see cref="ZStringOutput"/> using the given <see cref="ZStringBuilder"/>.
 /// </summary>
 public ZStringOutput(ZStringBuilder stringBuilder)
 {
     Output = stringBuilder;
 }
Exemple #6
0
 /// <summary>
 /// Creates a new instance of <see cref="ZStringOutput"/> with the given initial capacity.
 /// </summary>
 /// <param name="capacity">The estimated capacity required. This will reduce or avoid incremental buffer increases.</param>
 public ZStringOutput(int capacity)
 {
     Output = Utilities.ZStringBuilderExtensions.CreateZStringBuilder(capacity);
 }
Exemple #7
0
 /// <summary>
 /// Creates a new instance of <see cref="ZStringOutput"/>.
 /// </summary>
 public ZStringOutput()
 {
     Output = Utilities.ZStringBuilderExtensions.CreateZStringBuilder();
 }
Exemple #8
0
 ///<inheritdoc/>
 public void Write(ZStringBuilder stringBuilder, IFormattingInfo?formattingInfo = null)
 {
     // Nothing to do here
 }