diff --git a/src/ImageSharp/Metadata/Profiles/IPTC/IptcProfile.cs b/src/ImageSharp/Metadata/Profiles/IPTC/IptcProfile.cs index 4c20f6c15..d7bd09758 100644 --- a/src/ImageSharp/Metadata/Profiles/IPTC/IptcProfile.cs +++ b/src/ImageSharp/Metadata/Profiles/IPTC/IptcProfile.cs @@ -15,7 +15,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Iptc; /// public sealed class IptcProfile : IDeepCloneable { - private Collection values; + private readonly Collection values = new(); private const byte IptcTagMarkerByte = 0x1c; @@ -53,8 +53,6 @@ public sealed class IptcProfile : IDeepCloneable { Guard.NotNull(other, nameof(other)); - this.values = new Collection(); - foreach (IptcValue value in other.Values) { this.values.Add(value.DeepClone()); @@ -307,16 +305,8 @@ public sealed class IptcProfile : IDeepCloneable return offset; } - [MemberNotNull(nameof(values))] private void Initialize() { - if (this.values != null) - { - return; - } - - this.values = new Collection(); - if (this.Data == null || this.Data[0] != IptcTagMarkerByte) { return;