internal static ChannelBinding CreateCopy(ChannelBinding source)
 {
     if (source.IsInvalid || source.IsClosed)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ObjectDisposedException(source.GetType().FullName));
     }
     if (source.Size <= 0)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("source.Size", source.Size, System.ServiceModel.SR.GetString("ValueMustBePositive")));
     }
     ChannelBindingUtility.DuplicatedChannelBinding binding = new ChannelBindingUtility.DuplicatedChannelBinding();
     binding.Initialize(source);
     return binding;
 }
            internal static ChannelBinding CreateCopy(ChannelBinding source)
            {
                Fx.Assert(source != null, "source ChannelBinding should have been checked for null previously");

                if (source.IsInvalid || source.IsClosed)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ObjectDisposedException(source.GetType().FullName));
                }

                if (source.Size <= 0)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("source.Size", source.Size,
                        SR.GetString(SR.ValueMustBePositive)));
                }

                //Instantiate the SafeHandle before trying to allocate the native memory
                DuplicatedChannelBinding duplicate = new DuplicatedChannelBinding();

                //allocate the native memory and make a deep copy of the original.
                duplicate.Initialize(source);

                return duplicate;
            }