コード例 #1
0
 /// <summary>
 /// Creates a new instance of ContextLib.MultiLevelData class.
 /// </summary>
 /// <param name="mld">Another instance of MultiLevelData from which data will be duplicated.</param>
 public MultiLevelData(MultiLevelData mld)
 {
     _text = (mld.Text == null ? null : (string)mld.Text.Clone());
     if (_fileList != null)
     {
         _fileList = new string[mld._fileList.Length];
         Array.Copy(mld._fileList, _fileList, _fileList.Length);
     }
     else
     {
         _fileList = null;
     }
     _image = (mld.Image == null ? null : (Image)mld.Image.Clone());
     _audio = mld._audio;
 }
コード例 #2
0
 /// <summary>
 /// Determines whether this data container and the specified one have the same value.
 /// </summary>
 /// <param name="mld">A MultiLevelData container.</param>
 /// <returns>True if the two objects have the same value, false otherwise.</returns>
 public bool Equals(MultiLevelData mld)
 {
     if ((object)mld == null)
     {
         return(false);
     }
     else
     {
         bool isTextEqual, isImgEqual, isStrEqual, isStreamEqual;
         isTextEqual   = (this.Text == null || mld.Text == null ? (this.Text == mld.Text) : (this.Text.Equals(mld.Text)));
         isImgEqual    = (this.Image == null || mld.Image == null ? (this.Image == mld.Image) : (this.Image.Equals(mld.Image)));
         isStrEqual    = (this.FileList == null || mld.FileList == null ? (this.FileList == mld.FileList) : (this.FileList.Equals(mld.FileList)));
         isStreamEqual = (this.Audio == null || mld.Audio == null ? (this.Audio == mld.Audio) : (this.Audio.Equals(mld.Audio)));
         return(isTextEqual && isImgEqual && isStrEqual && isStreamEqual);
     }
 }
コード例 #3
0
        /// <summary>
        /// Determines whether this data container and the specified object have the same value.
        /// </summary>
        /// <param name="obj">A system object.</param>
        /// <returns>True if the two objects have the same value, false otherwise.</returns>
        public override bool Equals(object obj)
        {
            if (obj == null) // check if its null
            {
                return(false);
            }
            MultiLevelData mld = (MultiLevelData)obj;

            if (mld == null) // check if it can be casted
            {
                return(false);
            }

            bool isTextEqual, isImgEqual, isStrEqual, isStreamEqual;

            isTextEqual   = (this.Text == null || mld.Text == null ? (this.Text == mld.Text) : (this.Text.Equals(mld.Text)));
            isImgEqual    = (this.Image == null || mld.Image == null ? (this.Image == mld.Image) : (this.Image.Equals(mld.Image)));
            isStrEqual    = (this.FileList == null || mld.FileList == null ? (this.FileList == mld.FileList) : (this.FileList.Equals(mld.FileList)));
            isStreamEqual = (this.Audio == null || mld.Audio == null ? (this.Audio == mld.Audio) : (this.Audio.Equals(mld.Audio)));
            return(isTextEqual && isImgEqual && isStrEqual && isStreamEqual);
        }