访问会话值是否需要付费?除了访问(我推测)词典的成本。也许会话每次被访问时都会反序列化。
例如,我发现有些人将会话值放在变量中。
_sessionValue = CType(Session(SESSION_NAME), SomeClass)
_sessionValue.SomeFunction1()
_sessionValue.SomeFunction2()
其他人创建了一个属性
Public ReadOnly Property SessionValue As SomeClass
Get
Return CType(Session(SESSION_NAME), SomeClass)
End Get
End Property
SessionValue.SomeFunction1()
SessionValue.SomeFunction2()
我想知道两者之间的速度是否存在显着差异,或者是否建议从另一方推迟。