使用C#在asp.net中创建全局变量全局变量、asp、net

2023-09-06 09:17:18 作者:沉 沦゛

我正在窗口器件的应用previously我曾经建立在vb.net中使用模块的全局变量,但我发现,在C#中有模块的概念。所以我如何在C#中创建全局vaiables

I was working on window appication previously where i used to create global variables using modules in vb.net, but i found that in C# there is no concept of modules. so how can i create global vaiables in C#

推荐答案

您谈论一个web应用程序,所以我会建议你使用的会话状态如果你的变量将仅在一个会话中使用。我会建议你使用申请国家的应用范围的变量。

You're talking about a web application, so I will recommend you to use Session State if your variables will be used in one session only. And I will recommend you to use Application State for application wide variables.

 
精彩推荐