Creating Visual Studio Code - Using Uppercase Names

I prefer to use actual type names for primitive types instead of their corresponding keywords, for example String instead of String , Int32 instead of int , etc., because I like to have consistent syntax and wrapper - that is, type names are colored like typenames (aqua blue ) and properly cased (uppercase first letters).

How can I tell VS that whenever it generates any code (for example, when I select the "Implement an interface" option on the interface name or an automatically generated event handler and something else), it should add type names in my opinion taste?

+5
source share
1 answer

One option is that you can manually change the fragments that interest you. In Visual Sutio (I use 2013 Community Edition), go to Tools → Code Snippet Manager ... (or press Ctrl + K , Ctrl + B ). You will get a dialog with all the VS fragments using:

enter image description here

Select the fragment you want to change. For instance. for a loop in Visual C #. You will get the location of the fragment. You can edit it. For example, declaring a fragment of a for loop:

 <Snippet> <Declarations> <Literal> <ID>index</ID> <Default>i</Default> <ToolTip>Index</ToolTip> </Literal> <Literal> <ID>max</ID> <Default>length</Default> <ToolTip>Max length</ToolTip> </Literal> </Declarations> <Code Language="csharp"><![CDATA[for (int $index$ = 0; $index$ < $max$; $index$++) { $selected$ $end$ }]]> </Code> </Snippet> 

To get what you want, you need to replace for (int $index$ = 0; with for (Int32 $index$ = 0;

To change all the fragments is a laborious task, but I am sure that in most cases you can use the Notepad ++ search and replace function (if you correctly and accurately determine what needs to be replaced) to replace the aliases with the correct type names.

+2
source

All Articles