InvokeOnSerializing() 개인적인 메소드

private InvokeOnSerializing ( object obj, StreamingContext context ) : void
obj object
context StreamingContext
리턴 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);
            }
        }
        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);
                }
            }
        }