|
Yes, I know. I was referring to the case of the letters within the identifier. I thought that was blindingly obvious.
/ravi
|
|
|
|
|
With programmers, nothing is "obvious" unless it's in the specs. I assumed that everyone would simply follow the guidelines from Microsoft, making this a non-question.
Bastard Programmer from Hell
|
|
|
|
|
Probably a dumb question, but where can I find the Microsoft guidelines for this?
|
|
|
|
|
Caydence wrote: Probably a dumb question
It's not, but I'm glad to see that you rather make a "dumb" impression and get an answer than look intelligent and move on without one.
Here they are[^]
Bastard Programmer from Hell
|
|
|
|
|
I don't mind admitting I don't know something.
|
|
|
|
|
|
VS' Code Analysis' built-in dictionary checks your identifiers for spelling, grammatical case and other naming conventions of the .NET Framework guidelines. It's a great a way to gets started, and it's easy to modify/override spellings and naming conventions where necessary.
/ravi
|
|
|
|
|
Eddy Vluggen wrote: the guidelines from Microsoft
So, ummm... explain why Hashtable and DataTable don't agree.
|
|
|
|
|
I'm not an employee, and I didn't claim it was consistent. It is however, always a good starting place for ideas, and a good place to end discussions.
Bastard Programmer from Hell
|
|
|
|
|
That's because one is a republican and the other, a democrat.
|
|
|
|
|
Mostly filename
But that's because I had to forcibly break myself of using strFilename ...
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
Did you used to have lots of lngFilename or blnFilenames as well?
Bastard Programmer from Hell
|
|
|
|
|
I saw a variable declared as longAss. Ass was short for assignment no.
|
|
|
|
|
That'd be a bigAss in Sql Server types
Bastard Programmer from Hell
|
|
|
|
|
|
In this case, path . This is in keeping with Microsoft's convention for naming files.
|
|
|
|
|
now do you use "filepath" or "filePath"?
Luc Pattyn [My Articles] Nil Volentibus Arduum
Fed up by FireFox memory leaks I switched to Opera and now CP doesn't perform its paste magic, so links will not be offered. Sorry.
|
|
|
|
|
|
What if it doesn't have a path, just the name of the file itself?
|
|
|
|
|
fileName and filenameAndPath .
Meh..
..is that with or without extension? A UNC-path, or local?
Bastard Programmer from Hell
|
|
|
|
|
Then just filename. It's a standard concatenation and MS is fairly clear on naming for contractions like this; all lower case.
|
|
|
|
|
'filename' (or 'Filename' if it's a property or 'DoSomethingWithFilename' etc) for me. I think of filename as a single composite word.
|
|
|
|
|
For a (local) variable or a private field I use the former; otherwise "FileName".
Camel case is only for use with Hungarian; and Hungarian is to be avoided.
|
|
|
|
|
variables: filename
Properties, classes, methods... : FileName
I hate constructs like sFileName or bMyBool to also indicate the type and also gVariable or _variable to indicate global or class variables, but that might be personal.
V.
|
|
|
|
|
I personally prefer filename just as other people have stated, it is easy to read. Arguably it is becoming part of the language as a single word, I tend to think of filename as a more specific concept than name of a file that the version with the space implies. As an aside some dictionaries seem to agree .http://dictionary.reference.com/browse/filename[^].
FXCop disagrees and insists on fileName (see this blog post/[^]), and consistency are important. I'd rather agree with the framework and I assume MS uses FXCop's default rules .I can't find an example of fileName , but I'm 75% sure I've seen it somewhere... As a second point filename looks odd set aside filePath .
So the answer is for consistancy go for fileName , but filename isn't so bad that you shouldn't use it if you find it easier to read, the important thing is to stick to one version in your code.
|
|
|
|