Beispiel #1
0
        public virtual Envelope Clone()
        {
            Envelope newObject = (Envelope)this.MemberwiseClone();

            if (_transportByReference == false && _message != null)
            {
                if (_message is ICloneable)
                {
                    newObject._message = ((ICloneable)_message).Clone();
                }
                else if (_message.GetType().IsClass)
                {// We need to use the slow cloning mechanism.
                    newObject._message = SerializationHelper.BinaryClone(_message);
                    SystemMonitor.CheckOperationError(newObject._message != null, "Failed to serialize message [" + _message.GetType().Name + "].");
                }

                // Non class items are supposed to be copied by referencing.
            }

            return(newObject);
        }