What is a context?

后端 未结 4 1907
攒了一身酷
攒了一身酷 2021-01-31 02:55

It seems to me that a Context class is a control console whose object can invoke any included functions, such as Datacontext and DomainContext in WCF Ria service. Do I understan

4条回答
  •  北荒
    北荒 (楼主)
    2021-01-31 03:12

    To me, a context object defines a set of values and/or functions that are bound to the current execution path. In other words, just like speaking about a technical topic in the context of a job interview is different than speaking about the same topic at a nerd dinner, the context changes based on factors that affect the runtime environment of the consuming code. That seems abstract, but I can't think of a better way to describe it at the moment!

    Another famous context in .NET is the HttpContext object. Which values will change based on what Http operation is being handled. For example, the url will change in HttpContext.Current.Request.Uri. Hope that puts it in context for you :)

提交回复
热议问题