C
C#β€’11mo ago
samisaskinnyqueen

βœ… 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
samisaskinnyqueenβ€’11mo ago
Nevermind, .Clear was being run after WriteLine
Denis
Denisβ€’11mo ago
Main is the entry point of your program. It is called automatically once.your app starts
Denis
Denisβ€’11mo 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
samisaskinnyqueenβ€’11mo ago
If I were to call it something else would that change anything?
Denis
Denisβ€’11mo ago
Yes. It must be main You can create your own method and call it from main
samisaskinnyqueen
samisaskinnyqueenβ€’11mo ago
Ok thankyou πŸ‘
Denis
Denisβ€’11mo ago
If you have no further questions,.consider closing this thread using /close