C# StringBuilder Equals(StringBuilder)
Description
StringBuilder Equals(StringBuilder)
Returns a value
indicating whether this instance is equal to a specified object.
Syntax
StringBuilder.Equals(StringBuilder)
has the following syntax.
public bool Equals(
StringBuilder sb
)
Parameters
StringBuilder.Equals(StringBuilder)
has the following parameters.
sb
- An object to compare with this instance, or null.
Returns
StringBuilder.Equals(StringBuilder)
method returns true if this instance and sb have equal string, Capacity, and MaxCapacity
values; otherwise, false.
Example
The following code uses the Equals method to check whether two StringBuilder objects are equal.
//from www . j a v a 2s . co m
using System;
using System.Text;
class Sample
{
public static void Main()
{
StringBuilder sb1 = new StringBuilder("abc");
StringBuilder sb2 = new StringBuilder("abc", 16);
Console.WriteLine("a4) sb1 equals sb2: {0}", sb1.Equals(sb2));
}
}
The code above generates the following result.