c# global method without class code example
Example: c# global function without class
// No. in c# everything is an object
// Make them static and put them in a static utility class
// This way you can execute a method from any object any time
// Program.cs:
using static Functions;
class Program
{
static void Main()
{
Said("Hello World!");
}
}
// Functions.cs
public static class Functions
{
public static void Said(string message) => Console.WriteLine(message);
}
// NOTE: using static {namespace}