Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Would it be acceptable for some very generic utilities or classes to be added in the System namespace?

I'm thinking of really basic stuff like a generic EventArgs (EventArgs<T>),

Use case: would be shared in a company's core library (so that it can be recompiled in a new project as-is, without changing the namespace);

share|improve this question
add comment

4 Answers

up vote 16 down vote accepted

Not acceptable.

Could you? Yes, but System namespace is for framework base stuff. Even Microsoft does not put their own stuff into the System namespace (for example: such as C# compiler APIs or Registry).

System namespace is shared between Microsoft .NET, Mono, and DotGNU.

I would recommend using your company name, and then put the basic stuff in that namespace.

share|improve this answer
add comment

No, no, no. What would you do if the next .NET release contains a class with the same name? You are screwed as you would have to go through all of your files that include that class and rename all instances. You never add to a library to which you have no control. The easiest solution is to reverse the company URL. For example, if your company site is fred.com, create your classes in com.fred. It's pretty common to follow this naming convention.

share|improve this answer
3  
+1 for providing a clear and realistic reason to why it's a bad idea. –  Statement Mar 12 '11 at 19:52
3  
This is the main reason namespaces were invented, right? –  Statement Mar 12 '11 at 19:53
2  
The easiest solution is to reverse the company URL. For example, if your company site is fred.com, create your classes in com.fred. It's pretty common to follow this naming convention - in Java world. In .NET it's customary to use CompanyName.TechnologyName[.Feature][.Design] (as @Dal / @rmx pointed out) –  Konrad Morawski Mar 18 at 9:21
add comment

Microsoft have created a set of guidelines for namespace conventions.

This link is here: Microsoft Namespace Naming Guidelines.

share|improve this answer
2  
this is the line you need: CompanyName.TechnologyName[.Feature][.Design] –  rmx Mar 12 '11 at 13:21
add comment

Fully correct answers here, but no rule without exception: if you create something like LinqBridge (which is a .NET framework 2.0 replacement for .NET fw 3.5 classes in a 100% compatible way), then usage of the System namespace is mandatory. Or to answer this in a more general way: own usage of the System namespace is only a good idea if you have to port some higher version framework classes to a lower version, because you cannot upgrade your production version to the higher framework (and I guess this is the only valid reason for using this namespace).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.