Clone() public méthode

Creates a new object that is a copy of the current instance.
public Clone ( ) : object
Résultat object
Exemple #1
0
        /// <summary>
        ///   Creates a new object that is a copy of the current instance.
        /// </summary>
        ///
        /// <returns>
        ///   A new object that is a copy of this instance.
        /// </returns>
        ///
        public object Clone()
        {
            var clone = new Haralick();

            clone.autoGray     = autoGray;
            clone.cellSize     = cellSize;
            clone.degrees      = degrees;
            clone.distance     = distance;
            clone.featureCount = featureCount;
            clone.features     = (HaralickDescriptorDictionary[, ])features.Clone();
            clone.matrix       = (GrayLevelCooccurrenceMatrix)matrix.Clone();
            clone.mode         = mode;
            clone.normalize    = normalize;
            return(clone);
        }
        /// <summary>
        /// Creates a new object that is a copy of the current instance.
        /// </summary>
        ///
        protected override object Clone(ISet <PixelFormat> supportedFormats)
        {
            var clone = new Haralick();

            clone.SupportedFormats = supportedFormats;
            clone.autoGray         = autoGray;
            clone.cellSize         = cellSize;
            clone.degrees          = degrees;
            clone.distance         = distance;
            clone.featureCount     = featureCount;
            clone.SupportedFormats = SupportedFormats;
            if (features != null)
            {
                clone.features = (HaralickDescriptorDictionary[, ])features.Clone();
            }
            if (matrix != null)
            {
                clone.matrix = (GrayLevelCooccurrenceMatrix)matrix.Clone();
            }
            clone.mode      = mode;
            clone.normalize = normalize;
            return(clone);
        }