The following program compiles et executes just fine in recent versions of C#, where a Main function is not necessary:
Module2.SayHelloDouble();
static class Module1
{
public static void SayHello()
=> Console.WriteLine("Hello!");
}
static class Module2
{
public static void SayHelloDouble()
{
Module1.SayHello();
Module1.SayHello();
}
}
However, if I make the SayHello method "global static", the program does not compile anymore (verified with C# 12 / NET 8).
Is there a way to access a "global scope static method" from inside a class method ? Or is that simply impossible ?

The thing is that you are not making it global in any way, you are making it a local function (basically vice versa from what you have expected) for
Program.$Mainmethod which will be generated for top-level statement:Top-level statements is a feature introduced with C# 9 which allows to skip some boilerplate code for
Mainmethod declaration and make compiler it do for you.Basically the following:
Is turned by compiler to something like the following (a bit simplified, full decompilation @sharplab.io):