To me at least, the Pair class is a very multi-purpose class. So why did Microsoft put it into the System.Web.UI namespace?
Is there a reason that my tiny brain cannot comprehend?
Thanks.
In C#, a 2-tuple is a tuple that contains two elements and it is also known as pair. You can create a 2-tuple using two different ways: Using Tuple<T1,T2>(T1, T2) Constructor.
System. Web. UI represents an . aspx file, also known as a Web Forms page, requested from a server that hosts an ASP.NET Web application. The Page class is associated with files that have an .
It is used to serialize viewstate (along with its cousin Triplet).
I would guess that the reason they are not part of the base library (even though there is nothing ASP.NET-specific about them) is that they are not very useful since they are untyped.
To include untyped pair and triplet in the base library, might be seen as encouraging "typeless" programming.
A typed tuple might be useful, though (and I think F# has them). I think anonymous types covers most of the use cases for heterogenous tuples though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With