Program.cs is my main file and main method within is the entry point for my application. I have 2 other files, file1.cs and file2.cs.Both classes have its own string that I want to output using the Console.WriteLine function. When I run the program.cs file the output from the 2 other files dont show. If I run the code separately adding static void Main(string[] args) then it works.
I tried changing the name of the methods as well but no success. I also tried importing the namespaces in the program.cs file.
using File1;
using File2;
Can anyone provide some guidance or docs that could help me ?Thanks
Program.cs
using System;
namespace MyConsole
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Welcome User");
}
}
}
file1.cs
namespace File1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("This is string 1");
}
}
}
file2.cs
namespace File2
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("This is string 2");
}
}
}