Hi there,
I've been reading a book on c# and come across a method that is EnsureCapacity on StringBuilder which from understanding it makes sure that how much capacity a variable can hold.
What I made is a variable and then tested it.
StringBuilder st = new StringBuilder("string builder"); // the length == 14
When I call the EnsureCapacity on this variable,it gives me 16. However, it gives me the exact length of the variable if and only if I explicitly specify the maxCap when initialise my variable like so.
new StringBuilder("string builder", 14); 14 or less
thanks..