We have been discussing Tuple and its various possible uses. In almost all cases it sounds like root of evil, it makes design worse, and generally calls for a specialized class instead of Tuple everywhere it could be used.
It is supposedly close to DB but its hard to find a use for Tuple in db persistant logic code too.
Has anyone any real world good sample of Tuple use , preferably closer to some real world domain model problem or any use actualy.
Tupleis said to have been introduced to .NET 4 because some programming languages (let’s say, for example, IronPython or F#) support tuples as a core feature of the language, and the .NET BCL team wanted to provide a uniform tuple type for such languages (for language interoperability reasons, I guess):Tupledoes not make much sense in the C# language IMHO, because C# doesn’t support tuples and some associated language constructs very well; e.g. tuple “explosion”: spreading a tuple over a function’s parameters, or taking a function’s return values (in the form of aTuple) and spreading it over several local variables:That being said, if you’re writing only C# code, you can usually find “better”, more structured solutions than using
Tuple. For example, using tuples to return more than one value from a method (such as inGetFooabove) is quick and convenient, but the return value doesn’t have any inherent structure — you might do better with astructorclasstype, if you’re willing to take some additional time to define it.