LANGUAGE
notnull constraint
Expresses a non-nullable type-argument contract; violations generally warn with nullable analysis enabled, not runtime checks.
Formal Syntax & Structure
csharp syntaxcsharp
where T : notnullWorking Example
Example Snippetcsharp
static T Keep<T>(T value) where T : notnull => value;