How can I change the default Visual Studio C# new class file template?
You could modify the following file:
c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class.zip
It contains the template used when you add a new class. Inside the same folder you also have the template for interfaces: Interface.zip
so that they are public by default. IIRC a restart of VS is necessary to pick the changes.
You can create your own template by putting a file in C:\Users\you\Documents\Visual Studio 2010\Templates\ItemTemplates\Visual C#
.
For example, you can put "publicclass.cs" with this content :
using System;
using System.Collections.Generic;
$if$ ($targetframeworkversion$ >= 3.5)using System.Linq;
$endif$using System.Text;
namespace $rootnamespace$
{
public class $safeitemrootname$
{
}
}
In order to avoid the class dialog, you can use the smart tag. Anywhere you would to use an inexisting class, simply type the class name, and press AltShiftF10 to popout the "generate class" menu.
This is possible as described here and here.
You might see some issues due to the Template Cache of VS - on how to deal with them see esp. the comments here.
An "official" source on how to do this can be found at http://blogs.msdn.com/b/oanapl/archive/2009/03/06/visual-studio-templates-add-new-item-to-project.aspx