Quantcast
Channel: Better naming in Tuple classes than "Item1", "Item2" - Stack Overflow
Viewing all articles
Browse latest Browse all 21

Better naming in Tuple classes than "Item1", "Item2"

$
0
0

Is there a way to use a Tuple class, but supply the names of the items in it?

For example:

public Tuple<int, int, int int> GetOrderRelatedIds()

That returns the ids for OrderGroupId, OrderTypeId, OrderSubTypeId and OrderRequirementId.

It would be nice to let the users of my method know which is which. (When you call the method, the results are result.Item1, result.Item2, result.Item3, result.Item4. It is not clear which one is which.)

(I know I could just create a class to hold all these Ids, but it these Ids already have their own classes they live in and making a class for this one method's return value seems silly.)


Viewing all articles
Browse latest Browse all 21

Latest Images

Trending Articles



Latest Images