.NET Fiddle

CSharp · Console

/Program.cs

// as seen here
// https://stackoverflow.com/a/45594089/10870835
// (c) [email protected] licesne CC BY SA 4.0
using System;
using System.Runtime.CompilerServices;
// defined bellow
using static my.notmacros;

namespace my
{
	public struct notmacros
	{
		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static string whoami([CallerMemberName] string caller_name = null)
		{
			if (string.IsNullOrEmpty(caller_name))
				return "unknown";
			if (string.IsNullOrWhiteSpace(caller_name))
				return "unknown";
			return caller_name;
		}
	}
} // my namespace

public class Program
{
	public static void Main()
	{
		// this is called from main thus the result is "Main"
		var my_name = whoami();
		Console.WriteLine("Hello from {0}", my_name);
	}
}
;