static T? ReturnInput<T>(T? t) where T : notnull => t; // Notice nullable token (?) after IComparable constraint
var x = ReturnInput<string?>("test"); // Emits a warning, 'string?' invalidates the notnull constraint for T
var y = ReturnInput((int?) 3); // Emits a warning, 'int?' invalidates the notnull constraint for T
var z = ReturnInput((object?) null); // No warning. T is implictly set to 'object' rather than 'object?'.
// Notice that we can still accept maybe-null parameters and return maybe-null values,
// the 'notnull' constraint applies to the type parameter itself, not method parameters
// or return values.
Code snippet taken from "Complete C# Quick Reference - C# 8".