views:

490

answers:

3

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?

+4  A: 

AKU's answer should help you out:

http://stackoverflow.com/questions/55692/-net-namespaces#55700

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:

http://stackoverflow.com/questions/55692/-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.

HTH
Kev

Kev
A: 

C# naming convention is very close to Java's.

Com.DomainName.ProductName (namespace)
Com.DomainName.ProductName.ClassName (class)
Com.DomainName.ProductName.ClassName.IsUpperCase(string str) (method)

The major difference is that methods are usually starting with upper case letter, so do properties. Fields usually start with lower case letter.

Ilya Volodin
To all people down voting this answer, I didn't mean Com as Java "com", but instead as an abbreviation for Company.
Ilya Volodin
+2  A: 

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).

Joe Erickson
I've wondered why so many Java packages start with `com.`. Since almost all company domain names end in `.com`, it seems redundant.
Loadmaster
As far as I can remember - and I started using Java in 1995 or 1996 - it is simply the convention that Sun followed and everybody else followed along.
Joe Erickson
I've actually seen a lot of `org.*` and some `edu.*` packages. It fits with Java's "assume and write for the most unusual situation" inclinations.
ehdv