I have a series of classes that implement a Title (or Name) depending upon which word you semantica开发者_如何学运维lly choose. Is there a C# naming convention standard for Title vs Name?
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".
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{..};
}
精彩评论