Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C#

I thought i was doing everything right, yet im still getting an error message

Im doing the exercise exactly as he is doing it yet im still receiving an error message. The error message looks like this

prpgram.cs(4,7): error CS0101: The namespace '<global namespace>' already contains a definition for 'Program' [/home/treehouse/wor kspace/workspace.csproj]
prpgram.cs(12,17): error CS0111: Type 'Program' already defines a member called 'Main' with the same parameter types [/home/treeho use/workspace/workspace.csproj]

The build failed. Please fix the build errors and run again.

using System;

class Program
{  
    static void Add(double first, double second)
    {
        Console.WriteLine(first);
        Console.WriteLine(second);
        Console.WriteLine(first + second);
    }

    static void Subtract(double first, double second)
    {
        Console.WriteLine(first);
        Console.WriteLine(second);
        Console.WriteLine(first - second);
    }

    static void Main(string[] args)
    {
        Add(3,5);
    }
}  ```

1 Answer

Steven Parker
Steven Parker
231,248 Points

To allow the issue to be replicated and investigated, make a snapshot of your workspace and post the link to it.