Tell me more ×
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 (requires an account with 50 reputation)

3 Answers

up vote 14 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 (requires an account with 50 reputation)

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
2  
+1 for providing a clear and realistic reason to why it's a bad idea. – Statement Mar 12 '11 at 19:52
2  
This is the main reason namespaces were invented, right? – Statement Mar 12 '11 at 19:53
add comment (requires an account with 50 reputation)

Microsoft have created a set of guidelines for namespace conventions.

This link is here: Microsoft Namespace Naming Guidelines.

share|improve this answer
this is the line you need: CompanyName.TechnologyName[.Feature][.Design] – rmx Mar 12 '11 at 13:21
add comment (requires an account with 50 reputation)

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.