Clone() public method

Clone clones the object
public Clone ( ) : object
return object
コード例 #1
0
ファイル: Layout.cs プロジェクト: GuySmithFerrier/NCLDR
        /// <summary>
        /// Combine combines a child with a parent as necessary and returns the combined object
        /// </summary>
        /// <param name="combinedLayout">The child object</param>
        /// <param name="parentLayout">The parent object</param>
        /// <returns>The combined object</returns>
        public static Layout Combine(Layout combinedLayout, Layout parentLayout)
        {
            if (combinedLayout == null && parentLayout == null)
            {
                return null;
            }
            else if (combinedLayout == null)
            {
                return (Layout)parentLayout.Clone();
            }
            else if (parentLayout == null)
            {
                return combinedLayout;
            }

            if (combinedLayout.Orientation == null)
            {
                combinedLayout.Orientation = parentLayout.Orientation;
            }
            else if (parentLayout.Orientation != null)
            {
                if (string.IsNullOrEmpty(combinedLayout.Orientation.CharacterOrder))
                {
                    combinedLayout.Orientation.CharacterOrder = parentLayout.Orientation.CharacterOrder;
                }

                if (string.IsNullOrEmpty(combinedLayout.Orientation.LineOrder))
                {
                    combinedLayout.Orientation.LineOrder = parentLayout.Orientation.LineOrder;
                }
            }

            return combinedLayout;
        }
コード例 #2
0
ファイル: Layout.cs プロジェクト: pifta/NCLDR
        /// <summary>
        /// Combine combines a child with a parent as necessary and returns the combined object
        /// </summary>
        /// <param name="combinedLayout">The child object</param>
        /// <param name="parentLayout">The parent object</param>
        /// <returns>The combined object</returns>
        public static Layout Combine(Layout combinedLayout, Layout parentLayout)
        {
            if (combinedLayout == null && parentLayout == null)
            {
                return(null);
            }
            else if (combinedLayout == null)
            {
                return((Layout)parentLayout.Clone());
            }
            else if (parentLayout == null)
            {
                return(combinedLayout);
            }

            if (combinedLayout.Orientation == null)
            {
                combinedLayout.Orientation = parentLayout.Orientation;
            }
            else if (parentLayout.Orientation != null)
            {
                if (string.IsNullOrEmpty(combinedLayout.Orientation.CharacterOrder))
                {
                    combinedLayout.Orientation.CharacterOrder = parentLayout.Orientation.CharacterOrder;
                }

                if (string.IsNullOrEmpty(combinedLayout.Orientation.LineOrder))
                {
                    combinedLayout.Orientation.LineOrder = parentLayout.Orientation.LineOrder;
                }
            }

            return(combinedLayout);
        }