Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6062237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:01:42+00:00 2026-05-23T09:01:42+00:00

What are the pros and cons of standardizing on using Option Compare Text vs

  • 0

What are the pros and cons of standardizing on using Option Compare Text vs Option Compare Binary for VB.NET development?

— EDIT —

Just some background since it seems like it would help – my development team has found it much easier to standardize on Option Strict On, Option Infer On, and Option Explicit due to their obvious advantages over the alternatives. What we haven’t found as easy to standardize on is Option Compare Text/Binary as there seem to be advantages and disadvantages to both and different developers have differing opinions. Some of the arguments for each side have been as follows:

Some of the advantages/arguments for Option Compare Text:

  1. It reduces verbosity in the code by removing the need for StringComparers and .ToLower() calls and StringComparison.OrdinalIgnoreCase all over the place
  2. Data needs are rarely concerned with casing, as evidenced by most databases being case-insensitive. Rarely would you ever really want to distinguish between THIS and This and this when doing a data comparison.
  3. Certain specific use cases are simpler when you don’t have to worry about casing. For example, handling ASP.NET control events where commands are sent to the codebehind as strings and casing-issues are difficult to track down as the compiler cannot help you. Think Select Case statements for <asp:repeater> events as an example.
  4. Many of the concerns raised about text comparison concern internationalization, which is often not that relevant to a lot of applications.
  5. VB specifically is case insensitive as a language, though Visual Studio helps you by at least enforcing consistency in your casing. SQL is case insensitive as well. Strings are the only place where you have to remember to worry about it, which highlights the awkwardness in ways you wouldn’t normally notice it if you were worried about it everywhere.

Some of the advantages/arguments for Option Compare Binary:

  1. C# works this way, as do most other languages. It’s somewhat unexpected to have alternate behavior and the unexpected is not good in programming.
  2. There is a slight performance penalty with Option Compare Text as evidenced by the IL generated on compile. Option Compare Binary doesn’t have that penalty.
  3. Option Compare Text only makes certain parts of string handling case insensitive. But, it doesn’t make it so that things like dictionary indexing are case insensitive by default. So, it’s not like Option Compare Text actually makes it so that you don’t have to worry about casing at all. If it only works half way, why bother?
  4. Programming is hard. It’s best not to attempt to smooth over that fact. Worrying about string casing is part of the deal. Humans recognize THIS is different from This and tHiS. Of course your code should too – after all, they aren’t really the exact same string.

So I’m really just wondering if there are any other considerations.

— EDIT 2 —

Perhaps it would help if I defined what I’d consider an answer to this. If you can point to any authoritative external resource that talks through these issues more thoroughly, or point to a standards and best practices discussion or book that gives guidance on this topic, that would certainly count.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:01:43+00:00Added an answer on May 23, 2026 at 9:01 am

    With Option Compare Text you don’t need to worry about case when comparing strings. That can be a big benefit, and avoid converting everything to lower ( or upper) case to comapre for string equality.

    The other place where this plays a part is sorting of strings. Option Compare Text will sort like the file list in Windows, but Option Compare Binary will sort like a Unix file list (all the upper case file names appear before the lower-case file names).

    Update

    After reading the comments and the other answer, and thinking a bit more, I’d say Option Compare Binary is the way to go from point of view of consistency with the rest of the .Net Framework. If dictionary keys etc. are case-sensitive regardless of the Option Compare setting then using binary comparisons by default throughout your code is just being consistent. All you then need to worry about is if, for a particular comparison, you need it to be case-insensitive and code for that.

    If you go with Option Compare Text then not only do you need to worry about whether or not you need a particular comparison to be case-(in)sensitive you also need to be aware of the default behaviour in the current context.

    It then becomes an argument not of consitency with other languages, but of consistency with the framework you’re developing to.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What are some pros/cons in using CSS as part of a theme instead of
What are some pros/cons for using the Reflection.Emit library versus CodeDOM for dynamically generating
What are the pros/cons of using black-box reuse over white-box reuse?
This may be a silly question for some of you, but what are Pros/Cons
What are the pros and cons of using table aliases in SQL? I personally
What are the pros and cons of using a hosting provider for a Subversion
What are the pros and cons of using Criteria or HQL ? The Criteria
What are the pros and cons of using nested public C++ classes and enumerations?
What are the pros/cons to using CTP technology for internal production softtware? By internal
What are the differences pros/cons of using either '/' or '#' as the regex

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.