RaiseOnSerializing() public method

public RaiseOnSerializing ( object target, StreamingContext contex ) : void
target object
contex StreamingContext
return void
        /// <summary>Registers the object upon which events will be raised.</summary>
        /// <param name="obj">The object to register.</param>
        public void RegisterObject(object obj)
        {
            if (this.seen.Contains(obj))
            {
                return;
            }
            SerializationCallbacks sc = SerializationCallbacks.GetSerializationCallbacks(obj.GetType());

            this.seen[obj] = 1;
            sc.RaiseOnSerializing(obj, this.context);
            if (sc.HasSerializedCallbacks)
            {
                this.callbacks = (SerializationCallbacks.CallbackHandler) Delegate.Combine(this.callbacks, new SerializationCallbacks.CallbackHandler(delegate(StreamingContext ctx)
                {
                    sc.RaiseOnSerialized(obj, ctx);
                }));
            }
        }
        public void RegisterObject(object obj)
        {
            if (seen.Contains(obj))
            {
                return;
            }

            SerializationCallbacks sc = SerializationCallbacks
                                        .GetSerializationCallbacks(obj.GetType());

            seen [obj] = HashHelper.NonNullObject;
            sc.RaiseOnSerializing(obj, context);

            if (sc.HasSerializedCallbacks)
            {
                // record for later invocation
                callbacks += delegate(StreamingContext ctx)
                {
                    sc.RaiseOnSerialized(obj, ctx);
                };
            }
        }