5

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

How can I tell VS that whenever it generates any code (for example when I select "Implement interface" option on an interface name, or an automatically generated event handler and whatnot) it should add the typenames according to my liking?

Balázs
  • 2,841
  • 2
  • 14
  • 33
  • Potential duplicate of http://stackoverflow.com/questions/6358620/visual-studio-default-auto-complete-to-use-system-type-name (which unfortunately has no answer) – Matt Cole Jun 21 '15 at 07:54
  • Maby this documentation will help you: http://stackoverflow.com/documentation/visual-studio/4229/visual-studio-snippets#t=201607311216586000103 – H. Pauwelyn Jul 31 '16 at 12:23

1 Answers1

2

One option is for you to manually change the snippets you are interested in. In Visual Sutio (I'm using 2013 Community Edition) go to Tools -> Code Snippets Manager... (or hit Ctrl+K, Ctrl+B). You will get a dialog with all the snippets VS is using:

enter image description here

Select snippet you want to change. E.g. for loop in Visual C# section. You will get the location of the snippet. You can edit it. For example snippet declaration of the 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 have to replace for (int $index$ = 0; with for (Int32 $index$ = 0;

To change all the snippets is a laborious task but I bet in most cases you can use Notepad++ find and replace function (if you correctly and precisely define what have to be replaced) to replace aliases with proper type names.

PiotrWolkowski
  • 7,550
  • 5
  • 38
  • 58