473,411 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Naming convention of functions

What is the naming convention for functions in c#?

Nov 17 '05 #1
11 1971
The naming guidelines can be found here...
http://msdn.microsoft.com/library/de...guidelines.asp

--
Tim Wilson
..Net Compact Framework MVP

<to********@hotmail.com> wrote in message
news:11********************@g44g2000cwa.googlegrou ps.com...
What is the naming convention for functions in c#?

Nov 17 '05 #2
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:
you could just google for the naming conventions for functions or Ms has a
veyr good doc for writing C# code.

check this link.
http://msdn.microsoft.com/library/de...guidelines.asp

--
Kannan.V
Home : http://www.kannanv.com
Blog : http://kannanv.blogspot.com
Web : http://www.DotnetLounge.net

"Any one who has never made a mistake has never tried anything new" - Einstein
"to********@hotmail.com" wrote:
What is the naming convention for functions in c#?


Nov 17 '05 #3
<to********@hotmail.com> wrote:
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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 17 '05 #4
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:
<to********@hotmail.com> wrote:
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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Nov 17 '05 #5
<to********@hotmail.com> wrote:
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

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 17 '05 #6
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?

Nov 17 '05 #7
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

Nov 17 '05 #8
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

Nov 17 '05 #9

<to********@hotmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
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
Nov 17 '05 #10
<to********@hotmail.com> wrote:
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?


Yup.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 17 '05 #11
Hi Bill, I was referring to a specific scenario and not generally,
though, no one could no that:)

Nov 17 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
by: Generic Usenet Account | last post by:
A lot has been said in this newsgroup regarding the "evil" set/get accessor methods. Arthur Riel, (of Vanguard Training), in his class, "Heuristis for O-O Analysis & Design", says that there is...
27
by: Derek | last post by:
The company where I work uses a naming convention that I have never used before. They use mixed-case letters for public member functions, but lower-case with underscores for the rest, like this:...
5
by: Ook | last post by:
Is there any kind of naming convention for accessor and modifiers? What I've been doing is something like this: // accessor int getSize(); // Modifier void setSize( int newsize); private:
0
by: Carl Colijn | last post by:
Hi all, Disclaimer: before I might trigger your "let's start a holy war!" button, I'd like to say I'm not intended to; I just post this message to get some input and not to promote "Yet Another...
0
by: Bruno Lavoie | last post by:
Hello, i'm etablishing a naming convention for a new project under postgresql. For tables, sequences, views, that's ok! I used good naming conventions for this in the past and i'll keep these...
6
by: dm1608 | last post by:
I'm relatively new to ASP.NET 2.0 and am struggling with trying to find the best naming convention for the BAL and DAL objects within my database. Does anyone have any recommendations or best...
114
by: Jonathan Wood | last post by:
I was just wondering what naming convention most of you use for class variables. Underscore, "m_" prefix, camel case, capitalized, etc? Has one style emerged as the most popular? Thanks for...
2
by: Bill Pursell | last post by:
In libabc, I have a function which takes a NULL-terminated array of character strings. A second, closely related function take a NULL-terminated array of void *: abc_foo( char ** ); abc_vfoo(...
23
by: Thorsten Kampe | last post by:
Okay, I hear you saying 'not another naming conventions thread'. I've read through Google and the 'naming conventions' threads were rather *spelling conventions* threads. I'm not interested...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.