Practical example where Tuple can be used in .Net 4.0?

后端 未结 19 730
后悔当初
后悔当初 2020-12-04 07:44

I have seen the Tuple introduced in .Net 4 but I am not able to imagine where it can be used. We can always make a Custom class or Struct.

19条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-04 08:01

    A few examples off the top of my head:

    • An X and Y location (and Z if you like)
    • a Width and Height
    • Anything measured over time

    For example you wouldn't want to include System.Drawing in a web application just to use Point/PointF and Size/SizeF.

提交回复
热议问题