C
C#•16mo ago
Cheetah

"name space 'helloworld2' already contains a definition for a 'program'

Man this my first code ever in c# it worked two seconds ago and now it dont what do i do pls heres the code " using System; namespace Helloworld2 { internal class Program { static void Main(string[] args) { int Number =0; Console.WriteLine("Hello world"); Console.Beep(); while (Number > 10) {Console.Beep(); Number++; Console.WriteLine("Beep");
} } } } " i have two error one that was the starting text thing and the otther is "type 'program' already defines a member called 'Main' with the same parameter types
15 Replies
Cheetah
CheetahOP•16mo ago
using System;


namespace Helloworld2
{
internal class Program
{
static void Main(string[] args)
{
int Number =0;

Console.WriteLine("Hello world");
Console.Beep();
while (Number > 10) {Console.Beep();
Number++;
Console.WriteLine("Beep");

}
}
}
}
using System;


namespace Helloworld2
{
internal class Program
{
static void Main(string[] args)
{
int Number =0;

Console.WriteLine("Hello world");
Console.Beep();
while (Number > 10) {Console.Beep();
Number++;
Console.WriteLine("Beep");

}
}
}
}
x0rld 👻 🎃
you have only this file in your solution ?
Cheetah
CheetahOP•16mo ago
this is the only c# code ive made... i litterly looked up a c# tutorrial watched like 20 min of it and started doing my own things so i think so
Angius
Angius•16mo ago
Show us a screenshot of your IDE, if you could At least the project explorer
Cheetah
CheetahOP•16mo ago
What is IDE? just a screenshot of my screen ?
Angius
Angius•16mo ago
The program you use to write code VS Code, Visual Studio, Rider, whatever it might be
Cheetah
CheetahOP•16mo ago
x0rld 👻 🎃
you have Beep.cs too
x0rld 👻 🎃
with the same function
Cheetah
CheetahOP•16mo ago
so like what do i do?
x0rld 👻 🎃
remove the function Main in beep.cs
Angius
Angius•16mo ago
And class Program Or just remove the whole file, really
x0rld 👻 🎃
juste remove beep.cs if there is only that inside
Cheetah
CheetahOP•16mo ago
ok ok it runs now thanks
Angius
Angius•16mo ago
All classes within a namespace need to have unique names All methods within a class need to have a unique signature All variables within a class or a method need to have a unique name
Want results from more Discord servers?
Add your server