Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Runtime / Serialization / SerializationObjectManager.cs / 1305376 / SerializationObjectManager.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SerializationObjectManager ** ** ** Purpose: Encapsulates serialization time management, mainly invoking serialization events ** ** ============================================================*/ namespace System.Runtime.Serialization { using System; using System.Collections; using System.Runtime.Serialization; using System.Security.Permissions; public sealed class SerializationObjectManager{ private Hashtable m_objectSeenTable = new Hashtable(); // Table to keep track of objects [OnSerializing] has been called on private SerializationEventHandler m_onSerializedHandler; private StreamingContext m_context; public SerializationObjectManager(StreamingContext context) { m_context = context; m_objectSeenTable = new Hashtable(); } [System.Security.SecurityCritical] // auto-generated_required public void RegisterObject(Object obj) { // Invoke OnSerializing for this object SerializationEvents cache = SerializationEventsCache.GetSerializationEventsForType(obj.GetType()); // Check to make sure type has serializing events if (cache.HasOnSerializingEvents) { // Check to see if we have invoked the events on the object if (m_objectSeenTable[obj] == null) { m_objectSeenTable[obj] = true; // Invoke the events cache.InvokeOnSerializing(obj, m_context); // Register for OnSerialized event AddOnSerialized(obj); } } } public void RaiseOnSerializedEvent() { if (m_onSerializedHandler != null) { m_onSerializedHandler(m_context); } } private void AddOnSerialized(Object obj) { SerializationEvents cache = SerializationEventsCache.GetSerializationEventsForType(obj.GetType()); m_onSerializedHandler = cache.AddOnSerialized(obj, m_onSerializedHandler); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TableLayoutCellPaintEventArgs.cs
- RuntimeConfig.cs
- SafeNativeMethods.cs
- BitmapEffectInput.cs
- DES.cs
- MarkupExtensionParser.cs
- ReturnEventArgs.cs
- TextControlDesigner.cs
- EmptyQuery.cs
- Polyline.cs
- HttpResponseInternalWrapper.cs
- DataStorage.cs
- InputScopeConverter.cs
- ReflectTypeDescriptionProvider.cs
- ArraySubsetEnumerator.cs
- BaseValidator.cs
- CapabilitiesSection.cs
- ToolStripButton.cs
- Utils.cs
- GridViewSortEventArgs.cs
- ExtendedProperty.cs
- SecurityIdentifierElementCollection.cs
- DataRecordInternal.cs
- SmiMetaData.cs
- MonikerSyntaxException.cs
- InstalledFontCollection.cs
- SqlInfoMessageEvent.cs
- SmtpException.cs
- WebPartConnectionsConnectVerb.cs
- WeakEventManager.cs
- StrongNameKeyPair.cs
- DocumentGridPage.cs
- BlockUIContainer.cs
- RequestQueue.cs
- CodePropertyReferenceExpression.cs
- WindowsAltTab.cs
- DefaultBinder.cs
- DataGridTable.cs
- CalendarDay.cs
- HGlobalSafeHandle.cs
- HtmlTextArea.cs
- PermissionListSet.cs
- TextElement.cs
- DetectEofStream.cs
- SafeMILHandle.cs
- DependencyPropertyChangedEventArgs.cs
- IndexerReference.cs
- Triplet.cs
- CodeDirectiveCollection.cs
- ResourceAttributes.cs
- DataControlFieldTypeEditor.cs
- StartUpEventArgs.cs
- XmlSerializationGeneratedCode.cs
- Helper.cs
- XmlIncludeAttribute.cs
- SocketAddress.cs
- SQLBoolean.cs
- TableTextElementCollectionInternal.cs
- Peer.cs
- ErrorFormatterPage.cs
- NativeMethods.cs
- WindowsSpinner.cs
- CapabilitiesPattern.cs
- ListViewSortEventArgs.cs
- TagPrefixCollection.cs
- TreeViewImageIndexConverter.cs
- pingexception.cs
- Visual3D.cs
- X509SecurityTokenProvider.cs
- TextRangeAdaptor.cs
- PreviousTrackingServiceAttribute.cs
- ProvidersHelper.cs
- CompilationRelaxations.cs
- UpDownEvent.cs
- RelationshipManager.cs
- BindingGraph.cs
- BaseParser.cs
- CodeObjectCreateExpression.cs
- XmlAnyAttributeAttribute.cs
- XmlnsDictionary.cs
- CompilationSection.cs
- GlobalizationAssembly.cs
- InfoCardRSAOAEPKeyExchangeDeformatter.cs
- URLIdentityPermission.cs
- SequentialUshortCollection.cs
- ConnectionOrientedTransportChannelListener.cs
- Screen.cs
- Lasso.cs
- XmlSchemaDocumentation.cs
- EditCommandColumn.cs
- KernelTypeValidation.cs
- TypeDelegator.cs
- ReadOnlyDataSource.cs
- Panel.cs
- ExtendLockCommand.cs
- SQLMembershipProvider.cs
- Annotation.cs
- MultiBinding.cs
- InstanceContextMode.cs
- XpsViewerException.cs