LANGUAGE

allows ref struct anti-constraint

C# 13 anti-constraint permitting ref struct arguments while requiring ref-safety rules; last in the constraint list.

Formal Syntax & Structure

csharp syntaxcsharp
where T : allows ref struct

Working Example

Example Snippetcsharp
// Illustrative declaration, C# 13+static void Inspect<T>(T value) where T : allows ref struct { }
C# & .NET Reference