I can't serialize tuples. I create a template VS2019 .Net Core API project and replace the controller with:
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
[HttpGet]
public List<(int number, string text)> Get()
{
var x = new List<(int number, string text)>
{
(1, "one"),
(2, "two"),
(3, "three")
};
return x;
}
/*[HttpGet]
public List<string> Get()
{
var x = new List<string>
{
"one",
"two",
"three"
};
return x;
}*/
}
When called, the first method will return: [{},{},{}]
and the second (when uncommented): ["one","two","three"]
Why aren't the tuples serialized? The example is easy to replroduce.