InvokeOnSerializing() private method

private InvokeOnSerializing ( object obj, StreamingContext context ) : void
obj object
context StreamingContext
return void
コード例 #1
0
        public void RegisterObject(object obj)
        {
            SerializationEvents serializationEventsForType = SerializationEventsCache.GetSerializationEventsForType(obj.GetType());

            if (serializationEventsForType.HasOnSerializingEvents && this.m_objectSeenTable[obj] == null)
            {
                this.m_objectSeenTable[obj] = true;
                serializationEventsForType.InvokeOnSerializing(obj, this.m_context);
                this.AddOnSerialized(obj);
            }
        }
コード例 #2
0
        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 (_objectSeenTable.TryAdd(obj, true))
                {
                    // Invoke the events
                    cache.InvokeOnSerializing(obj, _context);
                    // Register for OnSerialized event
                    AddOnSerialized(obj);
                }
            }
        }