using System;
class Program
{
public static void SetName(string name) {
if (string.IsNullOrWhiteSpace(name)) {
throw new ArgumentNullException(nameof(name), "Name cannot be null or empty.");
}
Console.WriteLine($"Name set to {name}");
}
static void Main()
{
SetName("");
}
}
/*
run:
RROR!
Unhandled Exception:
System.ArgumentNullException: Name cannot be null or empty.
Parameter name: name
*/