This document is archived and information here might be outdated.  Recommended version.


IServerContext.SetObject Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Server > ESRI.ArcGIS.Server > Interfaces > IS > IServerContext Interface > IServerContext.SetObject Method
ArcGIS Developer Help

IServerContext.SetObject Method

Add an object running in the server context to the context's object dictionary.

[Visual Basic .NET]
Public Sub SetObject ( _
    ByVal Name As String, _
    ByVal obj As Object _
)
[C#]
public void SetObject (
    string Name,
    object obj
);
[C++]
HRESULT SetObject(
  BSTR Name,
  LPUNKNOWN obj
);
[C++]
Parameters
Name [in]

Name is a parameter of type BSTR obj [in]
obj is a parameter of type IUnknown

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Remarks

A context contains a dictionary that you can use as a convenient place to store objects that you create within the context. Note that this dictionary is itself valid only as long as you hold on to the server context and is emptied when you release the context. You can use this dictionary to share objects created within a context between different parts of your application that have access to the context.

SetObject adds objects to the dictionary, and GetObject  retrieves them. An object that is set in the context will be available until it is removed (by calling Remove or RemoveAll), or until the context is released.

See Also

IServerContext Interface