You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Add private constants to remove magic numbers from code.
- Improvements and simplification on parameters validations.
- Remove param names from exceptions.
/// Initializes a new instance of the <see cref="StringBuilder"/> class from the specified substring and capacity.
223
227
/// </summary>
224
-
/// <param name="value">The string that contains the substring used to initialize the value of this instance. If value is null, the new StringBuilder will contain the empty string (that is, it contains Empty).</param>
228
+
/// <param name="value">The string that contains the substring used to initialize the value of this instance. If value is <see langword="null"/>, the new <see cref="StringBuilder"/> will contain the empty string (that is, it contains <see cref="string.Empty"/>).</param>
225
229
/// <param name="startIndex">The position within value where the substring begins.</param>
226
230
/// <param name="length">The number of characters in the substring.</param>
227
231
/// <param name="capacity">The suggested starting size of the <see cref="StringBuilder"/>.</param>
/// <exception cref="ArgumentOutOfRangeException">If <paramref name="capacity"/> is less than zero, <paramref name="length"/> is less than zero, <paramref name="startIndex"/> is less than zero, or <paramref name="startIndex"/> is greater than the length of <paramref name="value"/> minus <paramref name="length"/>.</exception>
/// Initializes a new instance of the <see cref="StringBuilder"/> class using the specified string and capacity.
278
+
/// Initializes a new instance of the <see cref="StringBuilder"/> class using the specified string and capacity.
259
279
/// </summary>
260
-
/// <param name="value">The string used to initialize the value of the instance. If value is null, the new StringBuilder will contain the empty string (that is, it contains Empty).</param>
261
-
/// <param name="capacity">The suggested starting size of the <see cref="StringBuilder"/>.</param>
/// <param name="value">The string used to initialize the value of the instance. If value is <see langword="null"/>, the new <see cref="StringBuilder"/> will contain the empty string (that is, it contains <see cref="string.Empty"/>).</param>
281
+
/// <param name="capacity">The suggested starting size of the StringBuilder.</param>
282
+
publicStringBuilder(
283
+
stringvalue,
284
+
intcapacity)
285
+
:this(value,0,value
286
+
!=null?value.Length:0,capacity)
287
+
{}
264
288
265
289
/// <summary>
266
-
/// Initializes a new instance of the <see cref="StringBuilder"/> class that starts with a specified capacity and can grow to a specified maximum.
290
+
/// Initializes a new instance of the <see cref="StringBuilder"/> class that starts with a specified capacity and can grow to a specified maximum.
267
291
/// </summary>
268
292
/// <param name="capacity">The suggested starting size of the <see cref="StringBuilder"/>.</param>
269
293
/// <param name="maxCapacity">The maximum number of characters the current string can contain.</param>
270
-
publicStringBuilder(intcapacity,intmaxCapacity)
294
+
/// <exception cref="ArgumentOutOfRangeException">If <paramref name="capacity"/> is less than zero, <paramref name="maxCapacity"/> is less than one, or <paramref name="capacity"/> is greater than <paramref name="maxCapacity"/>.</exception>
/// Initializes a new instance of the <see cref="StringBuilder"/> class using the specified capacity.
316
+
/// Initializes a new instance of the <see cref="StringBuilder"/> class using the specified capacity.
291
317
/// </summary>
292
318
/// <param name="capacity">The suggested starting size of this instance.</param>
293
319
publicStringBuilder(intcapacity)
294
320
:this(string.Empty,capacity){}
295
321
296
322
/// <summary>
297
-
/// Initializes a new instance of the <see cref="StringBuilder"/> class using the specified string.
323
+
/// Initializes a new instance of the <see cref="StringBuilder"/> class using the specified string.
298
324
/// </summary>
299
-
/// <param name="value">The string used to initialize the value of the instance. If value is <see langword="null"/>, the new <see cref="StringBuilder"/> will contain the empty string (that is, it contains <see cref="String.Empty"/>).</param>
325
+
/// <param name="value">The string used to initialize the value of the instance. If value is <see langword="null"/>, the new <see cref="StringBuilder"/> will contain the empty string (that is, it contains <see cref="string.Empty"/>).</param>
300
326
publicStringBuilder(stringvalue)
301
-
:this(value,0x10){}
327
+
:this(value,DefaultCapacity){}
302
328
303
329
/// <summary>
304
-
/// Initializes a new instance of the <see cref="StringBuilder"/> class.
330
+
/// Initializes a new instance of the <see cref="StringBuilder"/> class.
0 commit comments