开发者

How HttpContext.Current is visible for the whole application if it isn't static?

开发者 https://www.devze.com 2023-03-20 03:08 出处:网络
I really don\'t understand how a class like HttpContext.Current is visible (for t开发者_运维技巧he single request) to the whole web application, without be \"static\".

I really don't understand how a class like HttpContext.Current is visible (for t开发者_运维技巧he single request) to the whole web application, without be "static".

Which kind of treatment .NET do for that class?


In class HttpContext, Current is static property

public static HttpContext Current { get; set; }

More information see: http://msdn.microsoft.com/en-us/library/system.web.httpcontext.current.aspx


It is what is called a Singleton design pattern.

Here's a good explanation of the Singleton pattern with examples in C#

0

精彩评论

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