gpt4 book ai didi

c# - Triplet 类的用途是什么?它与元组有关吗?

转载 作者:太空狗 更新时间:2023-10-29 21:19:36 27 4
gpt4 key购买 nike

所以我刚刚了解了 Triplet类(class)。我没有使用 ASP.NET 的经验,只有核心 .NET Framework。

有人可以向我解释 Triplet 类存在的位置/原因吗?它像元组吗?

最佳答案

是的,它非常类似于 .NET 4.0 中的元组,但可以追溯到 .NET 1.0,尤其是 ASP.NET 1.0。它主要用于 ViewState serialization :

The Page class contains a SavePageViewState(), which is invoked during the page life cycle's save view state stage. The SavePageViewState() method starts by creating a Triplet that contains the following three items:

  1. The page's hash code. This hash code is used to ensure that the view state hasn't been #tampered with between postbacks. We'll talk more about view state hashing in the "View State and Security Implications" section.
  2. The collective view state of the Page's control hierarchy.
  3. An ArrayList of controls in the control hierarchy that need to be explicitly invoked by the page class during the raise postback event stage of the life cycle.

还有它的弟弟叫Pair .

绝对没有理由让您为这些类操心,否则会接踵而至的是一团邪恶的无类型困惑。

关于c# - Triplet 类的用途是什么?它与元组有关吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5702396/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com