Reputation: 198
I'm using Visual Studio 2013. I've created a blank solution in witch I have two different projects: "HelloCSharp" and "PrintMyName". In the first project there is a class with the following source code:
namespace HelloCSharp {
class HelloCSharp
{
static void Main(string[] args)
{
System.Console.WriteLine("Hello, C#!");
}
}
}
In the "PrintMyName" project there is a class with the following source code:
namespace PrintMyName
{
class PrintMyName
{
static void Main(string[] args)
{
System.Console.WriteLine("Rosen");
}
}
}
When I try to run this program, the method doesn't write the argument "Rosen" but the argument from the another class "Hello, C#!".
I try with alternative code but the result is the same ("Hello, C#!"):
namespace PrintMyName
{
class PrintMyName
{
static void Main(string[] args)
{
String myFirstName = "Rosen";
System.Console.WriteLine(myFirstName);
}
}
}
If someone have an idea what's the reason of this problem and how can I print my name, please send me an answer! Thanks!
Upvotes: 1
Views: 221
Reputation: 19081
You're probably not running the program you think you're running. Check that the correct project is set as start-up project in Visual Studio.
To change it, right click the project you want to run, and look for Set Start Up Project
(with a gear wheel symbol).
Upvotes: 3