0

Anyone know the rule for naming fields with the abbreviation "ID?"

I notice that MS is inconsistent, they have "PlatformID" and "ApplicationId."

I thought the rule was is the abbreviation was 3 characters or more, only the first letter is capitalized. Like Guid instead of GUID?

3
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by zachattack05
0

There are no strict rules, but more conventions.
You can follow them or not.
The only convention that is followed, with as far as I know, no exception, is that the name of an interface class starts with a capital I.

Edited by ddanbe: typo

0

There are no strict rules, but more conventions.
You can follow them or not.
The only convention that is followed, with as far as I know, no exception, is that the name of an interface class starts with a capital I.

True. I guess I was asking what the popular convention is?

0

True. I guess I was asking what the popular convention is?

There are a variety of conventions, none of which is overwhelmingly popular over all the others... since we're talking about C#, you could use Microsoft's official guidelines. Wikipedia has a more general discussion of various styles.

With respect to the inconsistency you mention, the Microsoft standard says:

The two abbreviations that can be used in identifiers are ID and OK. In Pascal-cased identifiers they should appear as Id, and Ok. If used as the first word in a camel-cased identifier, they should appear as id and ok, respectively.

By their own standard, PlatformID is incorrect, but I prefer it over PlatformId because the latter always reminds me of the id monster.

Edited by gusano79: typo

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.