Naming convention of functions

  • Thread starter Thread starter tonicvodka
  • Start date Start date
Thanks for your responses!

What I'm actually looking for is some support for writing get/set
functions camel case?
e.g. getCustomer() but I won't find that, will I? Anywhere?

Best Regards,
Niclas Colleen


Kannan.V [MCSD.net] skrev:
 
Thanks for your responses!

What I'm actually looking for is some support for writing get/set
functions camel case?
e.g. getCustomer() but I won't find that, will I? Anywhere?

No. Methods are always Pascal-cased by .NET conventions.
 
Thank you that's the decisive response I wanted.

Still it's not totally clear for me.

e.g. If I create a button and I call it btnSave, then the method this
button will trigger would be: btnSave_Click(...)

Is that correct? Or am I using an incorrect convention naming the
button?

Best regards,
Niclas Colleen

Jon skrev:
 
Thank you that's the decisive response I wanted.

Still it's not totally clear for me.

e.g. If I create a button and I call it btnSave, then the method this
button will trigger would be: btnSave_Click(...)

Is that correct? Or am I using an incorrect convention naming the
button?

Personally I find that a horrible name for a method, even though it's
what VS.NET will give you by default.

I'd suggest calling it something like: HandleSaveButtonClicked
 
I'm trying to get the naming guidelines straight here, and I guess this
means that VS.NET by default doesn't follow the naming guidelines?
 
responding to Kannan:

"What I'm actually looking for is some support for writing get/set
functions camel case?
e.g. getCustomer() but I won't find that, will I? Anywhere? "

Would you prefer to use property procedures for get/set methods? Again,
those would be Pascal case in C#.

Jason Gorman
http://www.parlezuml.com
UML tutorials for Java & .NET
 
Thank's for the suggestion, but no, I prefer using methods.

The thing is, I'm quite sure we used camel case for get/set methods on
a VC++ project I worked in a couple of years ago. I just came to
wanting to find out if that was some official naming convention or just
specific for that project.

Having just started up a VS.NET project now I'm keen on following the
general standards.

I'm starting to feel pretty content on the naming guidelines now a part
from my previous question, though.

Best regards,
Niclas Colleen
 
Thank's for the suggestion, but no, I prefer using methods.

The thing is, I'm quite sure we used camel case for get/set methods on
a VC++ project I worked in a couple of years ago. I just came to
wanting to find out if that was some official naming convention or just
specific for that project.

OK, I have to ask.

What do you have against properties?
The only time I use get/set methods explicitely is if my setter/getter
triggered "unusual behavior".

If my setter/getter does nothing more than validate/translate/store the
data, I think properties are the way to go.

Bill
 
Hi Bill, I was referring to a specific scenario and not generally,
though, no one could no that:)
 
Back
Top