什么是用于三联类?这是否与元组? [英] What is the Triplet class used for? Is it related to Tuples?

查看:159
本文介绍了什么是用于三联类?这是否与元组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

于是我就了解了 三联 类。我有一个ASP.NET没有经验,只有核心的.NET Framework。

在哪里/为什么三联类存在有人能解释一下吗?难道如元组?


解决方案

是的,这是一个从.NET 4.0 pretty很像元组,而是可以追溯到.NET 1.0和ASP.NET 1.0中尤其如此。它主要在 ViewState的序列化使用:


  

Page类包含一个 SavePageViewState(),这是在页面生命周期的保存视图状态阶段调用。在 SavePageViewState()方法开始通过创建一个三联包含以下三个项目:


  
  

      
  1. 页面的hash code。该散列code是用来确保视图状态尚未#tampered与回发之间。我们将详细讨论视图状态视图状态与安全的影响部分的散列。

  2.   
  3. 的控制层次的集体视图状态。

  4.   
  5. 的ArrayList 在控制层次结构需要明确的网页类在生命周期中的上升回发事件阶段调用控件。

  6.   

还有它的弟弟叫

有绝对没有理由你甚至应该理会这些类或者邪恶无类型的混乱将接踵而至。

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. 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.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆