In vb.net (or C#) I can't figure out how to compare a stringbuilder to a string. I have searched quite a bit and can't find the answer. I had to write my own routine. Isn't there a better way?
This doesn't work:
Dim s As String = "abc"
Dim sb As New StringBuilder("abc")
If sb.Equals(s) Then
Console.WriteLine(sb.ToString() + " DOES equal " + s)
Else
Console.WriteLine(sb.ToString() + " does NOT equal " + s)
End If
Results of that code is: abc does NOT equal abc
Isn't there some way of comparing a stringbuilder to a string without writing my own routine? It's probably something obvious that I'm missing since I can't find this question anywhere.