Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Naming Convention (Title vs. Name)

I have a series of classes that implement a Title (or Name) depending upon which word you semantically choose. Is there a C# naming convention standard for Title vs Name?

like image 534
Liz Avatar asked Apr 03 '11 04:04

Liz


2 Answers

Both are pretty common.

In my observation, Name is used more frequently for an object with an internal name or for business objects that naturally has a Name property (such as a person). For examples consider MemberInfo.Name and IIdentity.Name. Files are generally considered to have a "filename", and Names often serve the purpose of being at least a part of the object's identity.

Title is used more often to refer to a User Interface Control object or a business object that naturally has a title, like an article.

Personally, I think of a Title as being something that is human-readable, where as a Name is more of a locally scoped identifier that may or may not be human-readable. (I don't mean that the name has to be completely unique, but in many cases, it is - Either way, it tends to provide some identification in its use-context). I conceptually think of "Title" as closer to being interchangeable with "Label" than it is with "Name".

like image 131
smartcaveman Avatar answered Oct 20 '22 01:10

smartcaveman


This may not be a C# question but a common sense question applicable to many other areas beyond computers:

class Author
{
  string Name{..};
}

class Book
{
  string Title{..};
}
like image 35
soe Avatar answered Oct 20 '22 02:10

soe