开发者

ASP.NET: concept question regarding variable declaration

consider this code:

Partial Public Class MyAspNETClass
Inherits System.Web.UI.Page

Protected Shared MyVariable As String
....
....

2 questions:

  1. Is Myvariable a variable used local for each instance of the page ? Or that variable is "shared" for all users accessing my page ?
  2. Is MyVariable sa开发者_如何学运维ved in server memory, or is it saved on the viewstate of aspx page ?

This is 2 doubt i can't answering by myself, so i'm asking you ! Thanks


Because MyVariable is Shared it will be allocated in memory only once and shared by every instance of the class.

It is not stored in the ViewState

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜