✅ Best way to return Tuple<string, string> as an Array?
I have an interface called
IRequest
IRequest
, with Tuple lists called:
public List<Tuple<string, string>> Headers { get; set; } = new List<Tuple<string, string>>();public List<Tuple<string, string>> Cookies { get; set; } = new List<Tuple<string, string>>();
public List<Tuple<string, string>> Headers { get; set; } = new List<Tuple<string, string>>();public List<Tuple<string, string>> Cookies { get; set; } = new List<Tuple<string, string>>();
Unfortunately, when I export a class that inherits
IRequest
IRequest
as JSON, it's then hard to iterate through
Headers
Headers
and
Cookies
Cookies
, because Tuples in C# are treated like classes outside of it. (I'm using Angular to read the JSON).
What's the best solution to export that Tuple as an Array of strings in the JSON? Take into account I will have multiple classes that inherit IRequest, so a global solution that affects all classes would be perfect in that sense.