/// <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(); } }
// constructor public Delegate(MessageDigestSpi digestSpi, String algorithm) : base(algorithm) { this.DigestSpi = digestSpi; }