Quantcast
Channel: Namespace and class with the same name? - Stack Overflow
Browsing all 10 articles
Browse latest View live

Answer by Jonathan Alfaro for Namespace and class with the same name?

Even though I agree with other answers in that you should not name your class the same as your namespace there are times in which you cannot comply with such requirements.In my case for example I was...

View Article



Answer by Paul Sumpner for Namespace and class with the same name?

It happens when it's the main class of the namespace. So it's one motivation to put the namespace in a library, then the issue goes away if you add 'Lib' to the namespace name...namespace SocketLib{...

View Article

Answer by sonnyb for Namespace and class with the same name?

As others have said, it's a good practice to avoid naming a class the same as its namespace.Here are some additional naming suggestions from an answer by svick to a related question "Same class and...

View Article

Answer by Marcelo Myara for Namespace and class with the same name?

Old post, but here I go with another idea that may help someone:"...but it seems the only way to do that would be to make all the other classes inner classes of Scenegraph in the Scenegraph.cs file and...

View Article

Answer by GoTo for Namespace and class with the same name?

Giving the same name to the namespace and the class can confuse the compiler as others have said.How to name it then?If the namespace has multiple classes then find a name that defines all those...

View Article


Answer by Steve for Namespace and class with the same name?

Just Adding my 2 cents: I had the following class:namespace Foo { public struct Bar { } public class Foo { //no method or member named "Bar" }}The client was written like this:using Foo;public class...

View Article

Answer by Anton Shepelev for Namespace and class with the same name?

I would suggest that you follow the advice I got on microsoft.public.dotnet.languages.csharp to use MyLib.ScenegraphUtil.Scenegraph and MyLib.ScenegraphUtil.*.

View Article

Answer by myermian for Namespace and class with the same name?

CA1724: Type Names Should Not Match Namespaces ...Basically, if you follow Code Analysis for proper coding this rule says to not do what you are trying to do. Code Analysis is very useful in helping...

View Article


Answer by pinckerman for Namespace and class with the same name?

I don't recommend you to name a class like its namespace, see this article.The Framework Design Guidelines say in section 3.4 “do not use thesame name for a namespace and a type in that namespace”....

View Article


Namespace and class with the same name?

I'm organizing a library project and I have a central manager class named Scenegraph and a whole bunch of other classes that live in the Scenegraph namespace.What I'd really like is for the scenegraph...

View Article
Browsing all 10 articles
Browse latest View live




Latest Images