コード例 #1
0
 /// <summary>
 /// Initializes a new instance of <see cref="DicomElementBinaryData{T}"/> as a copy of another instance.
 /// </summary>
 /// <param name="other">Source <see cref="DicomElementBinaryData{T}"/>.</param>
 /// <exception cref="ArgumentNullException">Thrown if <paramref name="other"/> is null.</exception>
 public DicomElementBinaryData(DicomElementBinaryData <T> other)
 {
     if (other == null)
     {
         throw new ArgumentNullException("other");
     }
     if (other._array != null)
     {
         _array = new T[other._array.Length];
         other._array.CopyTo(_array, 0);
     }
     else if (other._stream != null)
     {
         _stream = new LargeMemoryStream();
         other._stream.WriteTo(_stream);
     }
 }
コード例 #2
0
        /// <summary>
        /// Determines whether the values of this <see cref="DicomElementBinaryData{T}"/> are equal to the values of the other instance.
        /// </summary>
        /// <param name="other">The other <see cref="DicomElementBinaryData{T}"/> with which to compare.</param>
        /// <returns>True if the two instances have the same number of values and the values are equal pairwise; False otherwise.</returns>
        public bool CompareValues(DicomElementBinaryData <T> other)
        {
            var count = Count;

            if (count != other.Count)
            {
                return(false);
            }

            for (var n = 0; n < count; ++n)
            {
                if (!Equals(GetValue(n), other.GetValue(n)))
                {
                    return(false);
                }
            }
            return(true);
        }