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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Jun 25, 2011, 8:21 AM
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.
Mahesh ChandPosted Jun 25, 2011, 10:26 AM
VulpesPosted Jun 25, 2011, 9:07 AM