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


ObjectStream Class (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > System > ESRI.ArcGIS.esriSystem > Classes > O > ObjectStream Class
ArcGIS Developer Help

ObjectStreamClass Class

Specialized kind of IStream for objects.

Product Availability

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

Description

When implementing your own objects, you will sometimes need to provide support for persistence. For example, with a custom feature renderer, persistence enables its settings to be written to an MXD file so that when ArcMap is restarted, the layer having custom rendering will be drawn in the same way as previously drawn. The COM concept of streams provides a way of reading and writing data to the persisted storage.

The ObjectStream is designed to allow you to correctly persist collections of ArcObjects objects in which there may be multiple references to a single object. For example if you persist both a Map and a LegendItem to the same stream, both may have references to a single layer. The ObjectStream ensures that the layer is only written to the persistence stream once. If you persist objects without an ObjectStream, you run the risk that the objects will be incorrectly rehydrated.

See the topics on implementing persistence for more details on implementing persistence on your custom objects with IObjectStream.

Supported Platforms

Windows, Solaris, Linux

Interfaces

Interfaces Description
IDocumentVersion Provides access to members that control the document version.
IObjectStream Provides access to members used to make objects and object references persistant. Use of this interface allows multiple references to the same object to be stored properly.