Ugly C# brace matching

Why are there different styles of brace matching for C# and C++ Personally I prefer the C++ style and would like the option to use the same in C#...

Answer this question

Ugly C# brace matching

  • Gidon Sela

    Ah - the dynamic brace/bracket highlighting. Now I know what you're talking about. The change in background for brace matching in C# is a bit hard on the eyes, especially if your monitor doesn't have great contrast. Unfortunately there is no way that I've seen to modify this behaviour. This would be a great suggestion at the Product Feedback Center. Drop a link to your suggestion here and I'll be happy to vote on it too!



  • Ky0suke

    Some of the addins let you control this, i know Whole Tomato Visual assist x does.

    Eric-


  • T-LIANGS

    I didn't mean the layout style. I meant the matching brace highlighting in the text editor. In C++ it changes the color and/or bolding of the matching brace. In C# it changes the background color. Unfortunately the latter style can be a bit visually confusing as it makes the insertion point hard to see. And who knows why C++ and C# use different highlighting techniques. Personally I would want to use the C++ style in all languages.
  • UB

    Everyone seems to have their favourite bracing style. In VS.NET 2003, you can change the default:

    for(int i=0; i<count; i++)
    {
      // Do something
    }

    to

    for(int i=0; i<count; i++) {
      // Do something
    }

    by going to Tools... Options... Text Editor... C#... Formatting... and checking the Identation box labelled "Leave open braces on same line as construct".

    If you're running VS2005, the options for formatting are much richer. You can find them in the same place, but you'll have to go through and figure out what you like.

  • Ugly C# brace matching