@Marcが言ったように、ASP.NETはそのためにキャッシュを使用しているようです。内部を参照してくださいTemplateControl.HookUpAutomaticHandlers
。
dotPeekを使用したこのメソッドの一部:
internal void HookUpAutomaticHandlers()
{
...
object obj = TemplateControl._eventListCache[(object) this.GetType()];
if (obj == null)
{
lock (TemplateControl._lockObject)
{
obj = TemplateControl._eventListCache[(object) this.GetType()];
if (obj == null)
{
IDictionary local_1_1 = (IDictionary) new ListDictionary();
this.GetDelegateInformation(local_1_1);
obj = local_1_1.Count != 0 ? (object) local_1_1 : TemplateControl._emptyEventSingleton;
TemplateControl._eventListCache[(object) this.GetType()] = obj;
}
}
}
...
プライベートGetDelegateInformation
メソッドは、コントロールのデリゲートの作成を担当します。
テンプレート コントロールごとにデリゲートを保持する ですTemplateControl._eventListCache
。Hashtable
だから、あなたの質問に答える:
彼はすべての要求に対してそれを行いますか?
答えはノーだ。ASP.NET はこれを 1 回実行して thisHashtable
を設定し、キャッシュされた値を使用します。