This document is archived and information here might be outdated. Recommended version. |
ArcObjects namespaces > Server > ESRI.ArcGIS.Server > Interfaces > IS > IServerContext Interface > IServerContext.GetObject Method (ArcObjects .NET 10.4 SDK) |
Get a reference to an object in the server context's object dictionary by its Name.
[Visual Basic .NET] Public Function GetObject ( _ ByVal Name As String _ ) As Object
[C#] public object GetObject ( string Name );
[C++]
HRESULT GetObject(
BSTR Name,
LPUNKNOWN* obj
);
[C++]
Parameters Name [in] Name is a parameter of type BSTR obj [out, retval] obj is a parameter of type LPUNKNOWN
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.