[source,csharp] ---- using System; public sealed class NotNullAttribute : Attribute { } // The alternative name 'ValidatedNotNullAttribute' is also supported public static class Guard { public static void NotNull([NotNull] T value, string name) where T : class { if (value == null) { throw new ArgumentNullException(name); } } } public static class Utils { public static string Normalize(string value) { Guard.NotNull(value, nameof(value)); // Will throw if value is null return value.ToUpper(); // Compliant: value is known to be not null here. } } ----