I remember few weeks ago when I reorgnized our code and created some namespaces in our project I got error and the system did not allow me to create a companyName.projectName.System
namespace, I had to change it to companyName.projectName.Systeminfo
. I don't know why. I know there is a System
namespace but it is not companyName.projectName.System
. I think A.B.C
namespace should be different with A.A.C
namespace. Right?
EDIT
The error I got is like the this:
Error 7 The type or namespace name 'Windows' does not exist in the namespace 'MyCompany.SystemSoftware.System' (are you missing an assembly reference?) C:\workspace\SystemSoftware\SystemSoftware\obj\Release\src\startup\App.g.cs 39 39 SystemSoftware
C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...
Compared to other languages—like Java, PHP, or C#—C is a relatively simple language to learn for anyone just starting to learn computer programming because of its limited number of keywords.
What is C? C is a general-purpose programming language created by Dennis Ritchie at the Bell Laboratories in 1972. It is a very popular language, despite being old. C is strongly associated with UNIX, as it was developed to write the UNIX operating system.
History: The name C is derived from an earlier programming language called BCPL (Basic Combined Programming Language). BCPL had another language based on it called B: the first letter in BCPL.
You're experiencing a namespace clash.
If you name the last part of your namespace System, then the compiler will have a hard time determining if you're referring to the (Microsoft) System namespace or an inner System namespace at your current level (or even an System class or property or ...).
You'll experience the same problem with class names and namespace parts. You can't create a class called System for the same reasons.
Unless you feel like specifying full namespaces for all of your instances.
The code below compiles and runs, so I think you'll need to give us a bit more detail as there's no reason you can't create a namespace such as companyName.projectName.System
as far as I'm aware.
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var x = new ConsoleApplication1.Project.System.Something();
}
}
}
namespace ConsoleApplication1.Project.System
{
public class Something
{
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With