✅ General Help

namespace ConsoleApp1
{
public class Program
{
static void Main(string[] args)
{
Console.WriteLine("The Main function was called");
Console.ForegroundColor = ConsoleColor.Blue;

Console.BackgroundColor = ConsoleColor.White;
Console.Clear();

Console.ReadLine();
}
}
}
namespace ConsoleApp1
{
public class Program
{
static void Main(string[] args)
{
Console.WriteLine("The Main function was called");
Console.ForegroundColor = ConsoleColor.Blue;

Console.BackgroundColor = ConsoleColor.White;
Console.Clear();

Console.ReadLine();
}
}
}
Why does the Main function get called when I create it? And also, why aren't the colors in the console changing? ( I am new so please try to explain to the best of your ability)
7 Replies
samisaskinnyqueen
samisaskinnyqueenOP16mo ago
Nevermind, .Clear was being run after WriteLine
Denis
Denis16mo ago
Main is the entry point of your program. It is called automatically once.your app starts
Denis
Denis16mo ago
Main() and command-line arguments
Learn about Main() and command-line arguments. The 'Main' method is the entry point of an executable program.
samisaskinnyqueen
samisaskinnyqueenOP16mo ago
If I were to call it something else would that change anything?
Denis
Denis16mo ago
Yes. It must be main You can create your own method and call it from main
samisaskinnyqueen
samisaskinnyqueenOP16mo ago
Ok thankyou 👍
Denis
Denis16mo ago
If you have no further questions,.consider closing this thread using /close
Want results from more Discord servers?
Add your server