/// <summary> /// Initializes a new instance of the <see cref="ExifProfile"/> class /// by making a copy from another EXIF profile. /// </summary> /// <param name="other">The other EXIF profile, where the clone should be made from.</param> /// <exception cref="System.ArgumentNullException"><paramref name="other"/> is null.</exception> public ExifProfile(ExifProfile other) { Guard.NotNull(other, nameof(other)); this.Parts = other.Parts; this.thumbnailLength = other.thumbnailLength; this.thumbnailOffset = other.thumbnailOffset; this.invalidTags = new List <ExifTag>(other.invalidTags); if (other.values != null) { this.values = new Collection <ExifValue>(); foreach (ExifValue value in other.values) { this.values.Add(new ExifValue(value)); } } if (other.data != null) { this.data = new byte[other.data.Length]; Buffer.BlockCopy(other.data, 0, this.data, 0, other.data.Length); } }
/// <summary> /// Initializes a new instance of the <see cref="ExifProfile"/> class /// by making a copy from another EXIF profile. /// </summary> /// <param name="other">The other EXIF profile, where the clone should be made from.</param> /// <exception cref="System.ArgumentNullException"><paramref name="other"/> is null.</exception> public ExifProfile(ExifProfile other) { Guard.NotNull(other, nameof(other)); this.Parts = other.Parts; this.thumbnailLength = other.thumbnailLength; this.thumbnailOffset = other.thumbnailOffset; this.invalidTags = new List <ExifTag>(other.invalidTags); if (other.values != null) { this.values = new List <ExifValue>(other.Values.Count); foreach (ExifValue value in other.Values) { this.values.Add(new ExifValue(value)); } } if (other.data != null) { this.data = new byte[other.data.Length]; other.data.AsSpan().CopyTo(this.data); } }