问题描述
所以我刚刚了解了 Triplet
类.我没有 ASP.NET 的经验,只有核心 .NET Framework.
So I just learnt about the Triplet
class. I have no experience with ASP.NET, only the core .NET Framework.
有人可以向我解释 Triplet 类在哪里/为什么存在吗?它像元组吗?
Can someone explain to me where/why the Triplet class exists? Is it like a Tuple?
推荐答案
是的,它非常类似于 .NET 4.0 中的 Tuple,但可以追溯到 .NET 1.0,尤其是 ASP.NET 1.0.它主要用于ViewState 序列化:
Yes, it's pretty much like Tuple from .NET 4.0, but dates back to .NET 1.0 and ASP.NET 1.0 in particular. It's primarily used in ViewState serialization:
Page 类包含一个 SavePageViewState()
,它在页面生命周期的保存视图状态阶段被调用.SavePageViewState()
方法首先创建一个包含以下三个项目的 Triplet
:
The Page class contains a
SavePageViewState()
, which is invoked during the page life cycle's save view state stage. TheSavePageViewState()
method starts by creating aTriplet
that contains the following three items:
- 页面的哈希码.此哈希码用于确保视图状态在回发之间没有被#tampered.我们将在View State and Security Implications"中更多地讨论视图状态散列.部分.
Page
的控件层次结构的集合视图状态.- 控件层次结构中控件的
ArrayList
,需要在生命周期的引发回发事件阶段由页面类显式调用.
- 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.
- The collective view state of the
Page
's control hierarchy. - 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.
还有它的弟弟叫对
.
There's also its' younger brother called Pair
.
绝对没有理由您甚至应该为这些课程而烦恼,否则将会出现一团乱七八糟的无类型混乱.
There's absolutely no reason you should even bother about these classes or else an unholy untyped mess will ensue.
这篇关于Triplet 类的用途是什么?它与元组有关吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!