[RESOLVED] [1.0/1.1] Default Class Scope
Does anyone know if there is a way to change the default class scope and constructor scope when creating a new class? 90% of my classes are internal, so I have to change the scope from public to internal and the default constructor every time. Just a small annoyance but an annoyance non the less.
Re: [1.0/1.1] Default Class Scope
dont think this is possible. You're just gonna have to change them to internal manually :(
Woka
Re: [1.0/1.1] Default Class Scope
Bloody annoying little thing, bugs me every time. How many people need public classes all the time? Internal has to be the most common scope.
Re: [1.0/1.1] Default Class Scope
I'm sure that you could create a VS macro to do it, although I have next to no experience with IDE macros so I couldn't give you any details.
Re: [1.0/1.1] Default Class Scope
Am I the only person who thinks that internal should be the default scope for new classes and their default constructor?
Re: [1.0/1.1] Default Class Scope
Here is what you can do:
Browse in your explorer to:
C:\Program Files\Microsoft Visual Studio .NET 2003\VC#\VC#Wizards\CSharpAddClassWiz\Templates\1033
Open the File "NewCSharpFile.cs" A Text Editor would do just fine.
Modify to your needs.
Save.
Close and reopen VS.
Now everytime you add a new Class, your new File will be the template for it.
You might want to save the original File somewhere, just in case you screw up !
Stephan
Re: [1.0/1.1] Default Class Scope
Thanks a lot, that's it sorted.
Re: [RESOLVED] [1.0/1.1] Default Class Scope
Nice one Sgt Onion :p
That's very very cool to know...more annoying that the class scope is adding/removing default comments too. imo.
Woooooof
Re: [1.0/1.1] Default Class Scope
Quote:
Originally Posted by GlenW
Am I the only person who thinks that internal should be the default scope for new classes and their default constructor?
I agree that the default scope for classes should be internal, but once the class is internal it doesn't matter if its members are public. You can't access a public member of a class you can't see, so a public constructor of an internal class is inaccessible from outside the current assembly.
Nice info Sgt-Peppa. :thumb: I think I'll have a look for the VB equivalent too.
Re: [1.0/1.1] Default Class Scope
Quote:
Originally Posted by jmcilhinney
I agree that the default scope for classes should be internal, but once the class is internal it doesn't matter if its members are public. You can't access a public member of a class you can't see, so a public constructor of an internal class is inaccessible from outside the current assembly.
Yes, I know, I did say it was a small annoyance, but I'm just a pedant.