Code:
/ 4.0 / 4.0 / 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.
// ==++==
//
// 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
- Trigger.cs
- TableItemStyle.cs
- ToolstripProfessionalRenderer.cs
- NetworkInformationException.cs
- Roles.cs
- ProcessingInstructionAction.cs
- ArraySortHelper.cs
- ToolStripDropDownClosedEventArgs.cs
- FixedBufferAttribute.cs
- RegexCaptureCollection.cs
- DeferredElementTreeState.cs
- XpsPartBase.cs
- BoundPropertyEntry.cs
- HtmlElementCollection.cs
- ControlPropertyNameConverter.cs
- SmtpNtlmAuthenticationModule.cs
- NestedContainer.cs
- DateTimeUtil.cs
- Rect3D.cs
- DebugView.cs
- HttpCacheParams.cs
- HebrewNumber.cs
- SoapAttributeOverrides.cs
- Dictionary.cs
- ExeConfigurationFileMap.cs
- NavigatorInput.cs
- WebResourceAttribute.cs
- Point3DAnimation.cs
- MaskedTextProvider.cs
- FormViewDeletedEventArgs.cs
- Interlocked.cs
- ListBindingHelper.cs
- ListControlConvertEventArgs.cs
- DashStyles.cs
- JsonEncodingStreamWrapper.cs
- SqlBooleanizer.cs
- SecurityContext.cs
- _OSSOCK.cs
- TextureBrush.cs
- SchemaObjectWriter.cs
- QueryStringConverter.cs
- PeerSecurityManager.cs
- ApplicationServiceManager.cs
- DefaultValidator.cs
- ProcessHostFactoryHelper.cs
- SingleConverter.cs
- CharAnimationBase.cs
- MailHeaderInfo.cs
- IriParsingElement.cs
- IPHostEntry.cs
- TypeSystemHelpers.cs
- DataGridViewRowEventArgs.cs
- ThreadAbortException.cs
- ClientUtils.cs
- X509CertificateValidator.cs
- CacheOutputQuery.cs
- SortQuery.cs
- FixedDocumentPaginator.cs
- FunctionDescription.cs
- ActiveXHost.cs
- EventLogTraceListener.cs
- ProtectedConfigurationSection.cs
- PaginationProgressEventArgs.cs
- SqlDataReader.cs
- Vector3D.cs
- MutexSecurity.cs
- MemberDescriptor.cs
- ReferencedAssembly.cs
- AesCryptoServiceProvider.cs
- DataMemberAttribute.cs
- InputProcessorProfilesLoader.cs
- ErrorRuntimeConfig.cs
- XmlProcessingInstruction.cs
- WindowsFormsHost.cs
- CodeDirectiveCollection.cs
- FormatterServices.cs
- ExclusiveTcpListener.cs
- PackageStore.cs
- FrameworkRichTextComposition.cs
- ExceptionRoutedEventArgs.cs
- ICollection.cs
- CatalogZoneDesigner.cs
- COMException.cs
- PixelFormat.cs
- Link.cs
- FontStretch.cs
- SByteConverter.cs
- Zone.cs
- HwndStylusInputProvider.cs
- TimerEventSubscriptionCollection.cs
- BitmapCodecInfoInternal.cs
- ForeignKeyFactory.cs
- RuleCache.cs
- oledbconnectionstring.cs
- ReaderWriterLockWrapper.cs
- ToolStripCustomTypeDescriptor.cs
- Vector3D.cs
- XmlChoiceIdentifierAttribute.cs
- _LazyAsyncResult.cs
- ListViewItem.cs