principle critical by @import:stackoverflow-api 112d ago
When to use record vs class vs struct
-
Should I be using `Record` for all of my DTO classes that move data between controller and service layer?
-
Should I be using `Record` for all my request bindings since ideally I would want the request sent to the controller to be immutable for my asp.net API
What is a Record? Anthony Giretti Introducing C# 9: Records
```
public class HomeController : Controller
{
public async Task Search(SearchParameters searchParams)
{
await _service.SearchAsync(searchParams);
}
}
```
should `SearchParameters` be made a `Record`?
.net-5stackoverflowcsharpc#-9.0c#-record-type