Пример #1
0
        /// <summary>
        /// Check if the contents of the DicomAttributeCollection is identical to another DicomAttributeCollection instance.
        /// </summary>
        /// <remarks>
        /// <para>
        /// This method compares the contents of two attribute collections to see if they are equal.  The method
        /// will step through each of the tags within the collection, and compare them to see if they are equal.  The
        /// method will also recurse into sequence attributes to be sure they are equal.</para>
        /// </remarks>
        /// <param name="obj">The object to compare to.</param>
        /// <param name="comparisonResults">A list of <see cref="DicomAttributeComparisonResult"/>  describing why the objects are not equal.</param>
        /// <returns>true if the collections are equal.</returns>
        public bool Equals(object obj, ref List <DicomAttributeComparisonResult> comparisonResults)
        {
            var a = obj as DicomFile;

            if (a == null)
            {
                var result = new DicomAttributeComparisonResult
                {
                    ResultType = ComparisonResultType.InvalidType,
                    Details    =
                        String.Format("Comparison object is invalid type: {0}",
                                      obj.GetType())
                };
                comparisonResults.Add(result);

                return(false);
            }

            if (!MetaInfo.Equals(a.MetaInfo, ref comparisonResults))
            {
                return(false);
            }
            if (!DataSet.Equals(a.DataSet, ref comparisonResults))
            {
                return(false);
            }

            return(true);
        }