© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
60 replies
oe

✅ 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.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Next page

Similar Threads

Best way to uniquely hash an array of undefined length?
C#CC# / help
3y ago
✅ Best way to display a 2D array
C#CC# / help
4y ago