SayIt, don’t spray it! [Free program (and source code) makes it easy to use text-to-speech from your own programs and scripts]

This blog has moved to a new location and comments have been disabled.

All old posts, new posts, and comments can be found on The blog of

See you there!

Comments (4)
  1. RichardDeeming says:


    Is there a reason you're using "0 == string.Compare(…)" instead of "string.Equals(…)"?

  2. David Anson says:


    I usually go with string.Compare for its culture-correctness and flexibility. In this case I think I'm only ever doing ordinal comparisons and string.Equals would work the same, but I still like being consistent. 🙂

    Here's a blog post that has some great information on the topic:…/string-compare-string-equals-josh-free.aspx

  3. RichardDeeming says:

    That was correct for .NET 1, but .NET 2 added overloads of the static and instance Equals methods which accept a StringComparison parameter for precisely this reason:…/t4411bks%28v=VS.80%29.aspx…/ms973919.aspx

  4. David Anson says:


    Fair point – the two methods seem to be a lot more similar *now* than they originally were – and I agree either could have worked for my scenario. To be fair, Compare has more overloads (mainly to support passing a CultureInfo) and returns a value indicating the relative sort order, so it seems to remain the more capable of the two. That said, for my general purposes Equals may be more clear and I'll definitely consider using it next time this comes up. 🙂

    Thanks for the information!

Comments are closed.

Skip to main content