Why we need to use Tuples, instead of we can create class with strongly typed properties etc..
I think its good in using with huge projects that having lots of transactions to n fro.
Yet don't understood why its introduced in C# 4.0
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Jun 25, 2011, 4:21 AM EDT
As you rightly say, you can define your own class, with named properties etc, instead of using a tuple so they're really just a convenience where you don't really want the overhead of doing this in a particular case.
Tuples are immutable and I was surprised when the smaller ones were defined as classes rather than structs. However, I remember reading somewhere that they tried it both ways and found that there was little performance difference so they decided to use classes for all sizes of tuples in the interests of consistency.
VulpesRank #55 · 29.2K reputationPosted Jun 25, 2011, 5:07 AM EDT
Mahesh ChandRank #1 · 393.3K reputationPosted Jun 25, 2011, 6:26 AM EDT