"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
} } } } " 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
you have only this file in your solution ?
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
Show us a screenshot of your IDE, if you could
At least the project explorer
What is IDE?
just a screenshot of my screen
?
The program you use to write code
VS Code, Visual Studio, Rider, whatever it might be
you have Beep.cs too
with the same function
so like what do i do?
remove the function Main in beep.cs
And class
Program
Or just remove the whole file, reallyjuste remove beep.cs if there is only that inside
ok
ok it runs now thanks
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