Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is the Pair in System.Web.UI?

Tags:

.net

class

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.

like image 936
John MacIntyre Avatar asked Dec 03 '08 18:12

John MacIntyre


People also ask

What is Pair in c#?

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.

What is Systemui Web?

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 .


1 Answers

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.

like image 126
JacquesB Avatar answered Nov 25 '22 19:11

JacquesB