5 ms·
I believe c# has had tuple support since .net framework v4.
by phatboyslim 12y ago
I believe c# has had tuple support since .net framework v4.
- mvitorino 12y agoI believe tuple support in v4 is a simple set of classes. There is no language construct specific for the use of tuples, which means it's just a library instead of a programming language feature.
- andyjohnson0 12y agoWhat are the advantages that language-level tuples would have over the existing System.Tuple class?
- alkonaut 12y agoWithout deconstruction and pattern matching, language level tuples would be only sugar: "var x = (1, 2)" versus "var x = Tuple.Create(1,2)" The real power of Tuples only comes with deconstruction and matching, such as "var (a,b) = GetSomething()" and "case (_, y)". So these features would go hand in hand. Deconstruction and matching requires lang level tuples, and lang level tuples are pretty lame without deconstruction and pattern matching.
- olavk 12y agoThe ability to write (2, "hello") instead of Tuple.Create(2, "Hello"). But more importantly, syntax for deconstructing tuples will make tuples convenient for returning multiple values from a method. Eg.: (var x, var y) = getPoint(); as shown in the aticle.
- MichaelGG 12y agoAlso, the type is simpler to represent. Instead of Tuple<int, string> you just have something like (Int, String).