"Null-Correctness Assisting Attributes: NotNullWhen"

// NotNullWhen indicates that a parameter is not null when the return value of a method is true or false.

// The annotation here indicates that when 'TryParseUser()' returns true, 'u' will always have a value assigned.

public bool TryParseUser(string userIdentifier, [NotNullWhen(true)] out User u) { /* ... */ }


Code snippet taken from "Two Decades of C#: A Reference - C# 8".