什么是用于三联类?这是否与元组? [英] What is the Triplet class used for? Is it related to Tuples?
问题描述
于是我就了解了 三联
类。我有一个ASP.NET没有经验,只有核心的.NET Framework。
在哪里/为什么三联类存在有人能解释一下吗?难道如元组?
是的,这是一个从.NET 4.0 pretty很像元组,而是可以追溯到.NET 1.0和ASP.NET 1.0中尤其如此。它主要在 ViewState的序列化使用:
Page类包含一个
SavePageViewState()
,这是在页面生命周期的保存视图状态阶段调用。在SavePageViewState()
方法开始通过创建一个三联
包含以下三个项目:
- 页面的hash code。该散列code是用来确保视图状态尚未#tampered与回发之间。我们将详细讨论视图状态视图状态与安全的影响部分的散列。
- 在
页
的控制层次的集体视图状态。
- 的
的ArrayList
在控制层次结构需要明确的网页类在生命周期中的上升回发事件阶段调用控件。
块引用>还有它的弟弟叫
对
。有绝对没有理由你甚至应该理会这些类或者邪恶无类型的混乱将接踵而至。
So I just learnt about the
Triplet
class. I have no experience with ASP.NET, only the core .NET Framework.Can someone explain to me where/why the Triplet class exists? Is it like a Tuple?
解决方案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:
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:
- 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.
这篇关于什么是用于三联类?这是否与元组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!