Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Naming Practice for domain object named class

Tags:

c#

standards

I'm using a ORM and ran across a database table named Class. I've been naming the domain objects the same as their table name. So is Class a valid name for this object? I know it will compile but it doesn't seem like a good practice.

The table is refering to a versioned C# class.

like image 850
Will Avatar asked Jan 26 '10 20:01

Will


People also ask

How should you name classes?

Class names should be nouns, in mixed case with the first letter of each internal word capitalized. Try to keep your class names simple and descriptive. Use whole words-avoid acronyms and abbreviations (unless the abbreviation is much more widely used than the long form, such as URL or HTML).

How do you name a class in C#?

Naming convetion for classesA class definition starts with the keyword class followed by the class name; and the class body enclosed by a pair of curly braces.

Can we use underscore in class name?

Technically it's possible to use the underscore in a class name, but there's no practical reason to do so. If the underscore were used in a class name, it would act as a separator between words.


1 Answers

Its not good practice, and personally I would not do it, it compiles because in c# class != Class (its case sensitive)

class and all variations of class should be considered reserved words.

like image 70
zadeveloper Avatar answered Sep 28 '22 15:09

zadeveloper