knorv
knorv

Reputation: 50127

Naming conventions in C# compared to Java

The standard naming convention in the Java world is to name packages, classes and methods according to:

com.domainname.productname (package)
com.domainname.productname.ClassName (class)
com.domainname.productname.ClassName.isUpperCase(String str) (method)

What is the C#/.NET standard naming convention for the above cases?

Upvotes: 5

Views: 5327

Answers (2)

Kev
Kev

Reputation: 119856

AKU's answer should help you out:

.NET namespaces

He links to Microsoft's guidelines:

http://msdn.microsoft.com/en-us/library/893ke618(VS.71).aspx

You should consider reading the the rest of the guidelines starting here:

http://msdn.microsoft.com/en-us/library/czefa0ke(VS.71).aspx

The remainder of the post is also very informative:

.NET namespaces

In your case you would go with:

CompanyName.ProductName
CompanyName.ProductName.ClassName
CompanyName.ClassName.IsUpperCase(string str)

The .NET guidelines don't follow the Java style of using reversed FQ domain names to specify namespaces, and I've yet to see a commercial component such as Telerik or Infragistics for example follow anything other the guidelines than the MS ones.

Upvotes: 7

Joe Erickson
Joe Erickson

Reputation: 7227

It is rare to see "com." in C# or .NET:

DomainName.ProductName (namespace)
DomainName.ProductName.ClassName (class)
DomainName.ProductName.ClassName.IsUpperCase(String str) (method)

See the .NET Library Design Guidelines from Microsoft for the full scoop (this is really a .NET question more than a C# question).

Upvotes: 3

Related Questions