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
- StdValidatorsAndConverters.cs
- MyContact.cs
- ListMarkerLine.cs
- DateTimeAutomationPeer.cs
- Parsers.cs
- BaseCodeDomTreeGenerator.cs
- DesignOnlyAttribute.cs
- FrugalList.cs
- DataGridViewUtilities.cs
- WindowsAuthenticationEventArgs.cs
- EventLogTraceListener.cs
- LayoutEditorPart.cs
- Menu.cs
- SmiRecordBuffer.cs
- TypeDescriptor.cs
- BamlResourceSerializer.cs
- AnnotationHelper.cs
- XmlWriterDelegator.cs
- XmlDigitalSignatureProcessor.cs
- MemberPath.cs
- SQLGuid.cs
- Helpers.cs
- RelationshipType.cs
- WindowsContainer.cs
- SimpleWebHandlerParser.cs
- MetabaseServerConfig.cs
- SimpleExpression.cs
- InputBinding.cs
- MergePropertyDescriptor.cs
- base64Transforms.cs
- HopperCache.cs
- NavigatorInput.cs
- DockingAttribute.cs
- KeyedHashAlgorithm.cs
- SourceFileInfo.cs
- XPathScanner.cs
- DBCSCodePageEncoding.cs
- ToolStripDropDownMenu.cs
- AuthenticationServiceManager.cs
- ServicePointManager.cs
- VScrollProperties.cs
- EdmComplexTypeAttribute.cs
- Model3DCollection.cs
- WindowHelperService.cs
- ParameterToken.cs
- DoubleLinkList.cs
- FormsAuthenticationUser.cs
- X509Certificate.cs
- CodeDomDesignerLoader.cs
- XPathNavigator.cs
- OdbcTransaction.cs
- FixedDocument.cs
- OdbcCommandBuilder.cs
- TreeWalker.cs
- DataGridViewUtilities.cs
- FormViewDeleteEventArgs.cs
- Menu.cs
- VoiceObjectToken.cs
- TemplateColumn.cs
- TextEditorSelection.cs
- CaseCqlBlock.cs
- ValidationManager.cs
- BinaryFormatterSinks.cs
- XhtmlBasicObjectListAdapter.cs
- SQLBytes.cs
- CaseStatementSlot.cs
- RequestTimeoutManager.cs
- FlowLayoutPanel.cs
- ToolStripInSituService.cs
- AttachmentService.cs
- MaskInputRejectedEventArgs.cs
- ISO2022Encoding.cs
- HandlerBase.cs
- WindowAutomationPeer.cs
- SignatureDescription.cs
- DataBindingExpressionBuilder.cs
- _UriSyntax.cs
- BoolExpression.cs
- DataSetMappper.cs
- SocketInformation.cs
- LoginStatusDesigner.cs
- ReadWriteObjectLock.cs
- ToggleButton.cs
- HtmlControl.cs
- ObjectList.cs
- Vector3DCollection.cs
- PageHandlerFactory.cs
- CompiledXpathExpr.cs
- designeractionbehavior.cs
- SQLDouble.cs
- Util.cs
- Group.cs
- XmlExceptionHelper.cs
- ClientSettingsSection.cs
- HandleCollector.cs
- ArrayMergeHelper.cs
- ServiceAuthorizationManager.cs
- ToolStripTextBox.cs
- infer.cs
- ProxyWebPartManager.cs