Visual Studio's code Generator Customization (Off Topic)

  • Thread starter Thread starter SpookyET
  • Start date Start date
S

SpookyET

I wonder if you can configure Visual Studio to generate
Button1Click(object sender, EventArgs e) {}
instead of
button1_Click(object sender, EventArgs e) {}.

I am playing with SharpDevelop, and SharpDevelop is using the coding
style dictated by Microsoft. Methods should be named PascalCase.
Microsoft does not use their own dictaded coding styles in Visual Studio.
 
SpookyET said:
I wonder if you can configure Visual Studio to generate
Button1Click(object sender, EventArgs e) {}
instead of
button1_Click(object sender, EventArgs e) {}.

No way I know of.
I am playing with SharpDevelop, and SharpDevelop is using the coding style
dictated by Microsoft. Methods should be named PascalCase. Microsoft does
not use their own dictaded coding styles in Visual Studio.

I don't think private methods fall under the defintions in the class library
guidelines. As a whole only protected, internal, and public members fall
under these guidelines.
VS.NET chose to follow the vb6 style conventions for various reasons,
familiarity probably being chief among them.

While SharpDevelop uses a different standard, I would argue that it is
probably the less desirable behaviour as it breaks de facto conventions
instead of those one may consider the de jure conventions which mean less in
the real world.
 
Daniel said:
No way I know of.



I don't think private methods fall under the defintions in the class library
guidelines. As a whole only protected, internal, and public members fall
under these guidelines.
VS.NET chose to follow the vb6 style conventions for various reasons,
familiarity probably being chief among them.

While SharpDevelop uses a different standard, I would argue that it is
probably the less desirable behaviour as it breaks de facto conventions
instead of those one may consider the de jure conventions which mean less in
the real world.
The only way seems to do it manually using the events properties pane
instead of double-clicking on a control.
 
SpookyET said:
The only way seems to do it manually using the events properties pane
instead of double-clicking on a control.
You can hook event handlers up in code pretty easily:
control.Event += new EventHandler(method_name);

thats what I meant, you can use any method_name you wish.
 
Daniel said:
You can hook event handlers up in code pretty easily:
control.Event += new EventHandler(method_name);

thats what I meant, you can use any method_name you wish.
You can do that in the code, or you can do it in the Properties pane;
that is why I used the word "manually" earlier. The string might be
hardcoded inside Visual Studio, or it may be located in a configuration
file. It may be something like [controlName]_[EventName] declared there.
 
SpookyET said:
Daniel said:
Daniel O'Connell [C# MVP] wrote:



I wonder if you can configure Visual Studio to generate
Button1Click(object sender, EventArgs e) {}
instead of
button1_Click(object sender, EventArgs e) {}.


No way I know of.


I am playing with SharpDevelop, and SharpDevelop is using the coding
style dictated by Microsoft. Methods should be named PascalCase.
Microsoft does not use their own dictaded coding styles in Visual
Studio.


I don't think private methods fall under the defintions in the class
library guidelines. As a whole only protected, internal, and public
members fall under these guidelines.
VS.NET chose to follow the vb6 style conventions for various reasons,
familiarity probably being chief among them.

While SharpDevelop uses a different standard, I would argue that it is
probably the less desirable behaviour as it breaks de facto conventions
instead of those one may consider the de jure conventions which mean
less in the real world.

The only way seems to do it manually using the events properties pane
instead of double-clicking on a control.

You can hook event handlers up in code pretty easily:
control.Event += new EventHandler(method_name);

thats what I meant, you can use any method_name you wish.
You can do that in the code, or you can do it in the Properties pane; that
is why I used the word "manually" earlier. The string might be hardcoded
inside Visual Studio, or it may be located in a configuration file. It
may be something like [controlName]_[EventName] declared there.

Might be, but I don't know of one. You mighte be able to write a macro to
achieve it, try on the vstudio groups instead of here.
 
Back
Top