Tuples get a lot of hate in the C## world where they rarely see implementation, in part because of the obscurity of the “tuple” in certain programming languages such as C#, but also because the objects inside traditional C## Tuples are accessed as “Item1”, “Item2” and so on.
When it comes to how I return multiple properties from a method, here’s my hierarchy:
For me, creating a POCO just to store a method’s return value is the worst and last-resort option, yet it is probably the go-to for most C## developers in such a scenario. Using a custom POCO gives us Intellisense and allows us to access the results of the method by their property names. What’s not to love?
#tuples #c# #csharp #programming-c