Know any C# syntax-highlighting tricks? [closed]

2019-03-08 08:00发布

I usually prefer to code with a black background and white/coloured text but I had never taken the time to change my syntax-highlighting in Visual Studio.

Yesterday, when I finally got around to it one of my changes was to change User Types and User Types (Value Types) to different colors. Without realizing it, I had been using a struct type to pass and return data from methods more than I would have liked.

This change in syntax-highlighting made it very apparent what was going on. So it made me wonder if there were other settings which could provide similar help.

I also usually set my documentation and comment colours to something more washed out and passive so that actual code jumps more at you and makes quickly skimming through code faster.

Do you have any other tips like this which can help spot issues or makes things more readable?

Note: (I've seen this post, but I'm looking more for tips which are functional and provide help rather than purely cosmetic preferences.)

12条回答
狗以群分
2楼-- · 2019-03-08 08:26

Color strings bright so that you immediately notice them in your code. I use green for string on black. On grey I used to use yellow.

Btw I do the same for constants, numbers, etc.

查看更多
三岁会撩人
3楼-- · 2019-03-08 08:27

I really like Resharper's colorizing system. Using it you get a little more detail out of your editor. For example: fields, locals and parameters are all different colors. I have no idea why VS didn't include this out of the box.

查看更多
一纸荒年 Trace。
4楼-- · 2019-03-08 08:28

I make strings look horrible. Yellow background. Bold. Red foreground. To remind me that hardcoding strings is generally bad and to try as much as possible to minimize it!

查看更多
爷、活的狠高调
5楼-- · 2019-03-08 08:32

Use some nice color for interaces and an ugly one for user defined classes, that helps to decouple things.

The Vibrant Ink theme has some really well thought through things in it. I like to tone down the colors like this a bit htough, but it is a good start.

查看更多
倾城 Initia
6楼-- · 2019-03-08 08:32

I always set the brace matching background to something red, and make it bold. This way when I close braces or parens I can see what its being matched against.

查看更多
走好不送
7楼-- · 2019-03-08 08:42

I use a different color for classes and structs.

查看更多
登录 后发表回答