StringBuilder.EnsureCapacity : StringBuilder « System.Text « VB.Net by API






StringBuilder.EnsureCapacity

  

Imports System
Imports System.Text

Public Class MainClass

   Shared Sub Main()
      Dim buffer As StringBuilder = _
         New StringBuilder("Hello, how are you?")

      Dim output As String = "buffer = " & buffer.ToString & _
         vbCrLf & "Length = " & buffer.Length & vbCrLf & _
         "Capacity = " & buffer.Capacity

      buffer.EnsureCapacity(75)

      Console.WriteLine("New capacity = " & _
         buffer.Capacity)

      buffer.Length = 10
      
      Console.WriteLine("New Length = " & _
         buffer.Length & vbCrLf & "buffer = ")

   End Sub ' Main

End Class

   
    
  








Related examples in the same category

1.StringBuilder.Append
2.StringBuilder.AppendFormat
3.StringBuilder.Chars
4.StringBuilder.Insert
5.StringBuilder.Replace