Inheritance: java.lang.Object
Exemplo n.º 1
0
            /// <summary>
            /// Returns a clone if the delegate is cloneable.
            /// </summary>
            /// <returns> a clone if the delegate is cloneable.
            /// </returns>
            /// <exception cref="CloneNotSupportedException"> if this is called on a
            /// delegate that does not support {@code Cloneable}. </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public Object clone() throws CloneNotSupportedException
            public override Object Clone()
            {
                if (DigestSpi is Cloneable)
                {
                    MessageDigestSpi digestSpiClone = (MessageDigestSpi)DigestSpi.Clone();
                    // Because 'algorithm', 'provider', and 'state' are private
                    // members of our supertype, we must perform a cast to
                    // access them.
                    MessageDigest that = new Delegate(digestSpiClone, ((MessageDigest)this).Algorithm_Renamed);
                    that.Provider_Renamed = ((MessageDigest)this).Provider_Renamed;
                    that.State            = ((MessageDigest)this).State;
                    return(that);
                }
                else
                {
                    throw new CloneNotSupportedException();
                }
            }
Exemplo n.º 2
0
 // constructor
 public Delegate(MessageDigestSpi digestSpi, String algorithm) : base(algorithm)
 {
     this.DigestSpi = digestSpi;
 }