.NET 5.0 Web API won't work with record featuring required properties
问题 I'm using a C# 9.0 record type as a binding model for a .NET 5.0 Web API project. Some of the properties are required. I'm using the record positional syntax, but am receiving errors. public record Mail( System.Guid? Id, [property: Required] string From, [property: Required] string[] Tos, [property: Required] string Subject, string[]? Ccs, string[]? Bccs, [property: Required] Content[] Contents, Attachment[]? Attachments ); This is then exposed as the binding model for my Index action: public