Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why only Seven elements in a Tuple in C# 4.0, with the eighth being another tuple?

Tags:

.net

c#-4.0

f#

In F# the syntax sugar hides the CLR implementation, why not in C# 4.0?

like image 414
WeNeedAnswers Avatar asked Mar 17 '10 00:03

WeNeedAnswers


People also ask

Is tuple with 7 elements?

In C#, a 7-tuple is a tuple that contains seven elements and it is also known as Septuple.

Can a tuple have more than 2 elements C#?

The word "tuple" in C# refers to a data structure which may consist of multiple parts. This data structure may or may not be a dataset with multiple values. Tuples were first introduced with . NET framework 4.0, and they allow a maximum of 8 elements.

Can a tuple have 3 items?

A tuple is a data structure that has a specific number and sequence of values. The Tuple<T1,T2,T3> class represents a 3-tuple, or triple, which is a tuple that has three components. You can instantiate a Tuple<T1,T2,T3> object by calling either the Tuple<T1,T2,T3> constructor or the static Tuple.

Is tuple a 4 element?

In C#, a 4-tuple is a tuple that contains four elements and it is also known as quadruple. You can create a 4-tuple using two different ways: Using Tuple<T1,T2,T3,T4>(T1, T2, T3, T4) Constructor.


2 Answers

We considered adding a syntactic sugar for tuples. I think everyone agrees that it's a nice feature, but it simply didn't fit into the budget.

like image 191
Eric Lippert Avatar answered Oct 09 '22 10:10

Eric Lippert


It seems unlikely that someone using the features of the C# language to their appropriate level would require a Tuple containing more than 7 elements, especially given the existing and established techniques for problem solving and C#'s primarily OO approach to solution development.

F#, on the other hand, is a language designed to be primarily functional. As such, it does things in a primarily functional way and the language features are focused toward that primary concept. Resultantly, it made a lot more sense to spend the resources required to supply the language feature you're requesting in F# than it did in C#.

Remember that all new language features start with 100 points against them. :)

like image 24
Greg D Avatar answered Oct 09 '22 10:10

Greg D