diff --git a/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.TagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.TagDataEntry.cs
index 210f0b5e5..18280faaf 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.TagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.TagDataEntry.cs
@@ -686,8 +686,11 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
public int WriteProfileSequenceDescTagDataEntry(IccProfileSequenceDescTagDataEntry value)
{
int count = this.WriteUInt32((uint)value.Descriptions.Length);
- foreach (IccProfileDescription desc in value.Descriptions)
+
+ for (int i = 0; i < value.Descriptions.Length; i++)
{
+ ref IccProfileDescription desc = ref value.Descriptions[i];
+
count += this.WriteProfileDescription(desc);
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileDescription.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileDescription.cs
index 32e2a951e..685319fe4 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileDescription.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileDescription.cs
@@ -9,7 +9,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
/// ICC Profile description
///
- internal sealed class IccProfileDescription : IEquatable
+ internal readonly struct IccProfileDescription : IEquatable
{
///
/// Initializes a new instance of the class.
@@ -40,69 +40,47 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
///
- /// Gets the device manufacturer
+ /// Gets the device manufacturer.
///
public uint DeviceManufacturer { get; }
///
- /// Gets the device model
+ /// Gets the device model.
///
public uint DeviceModel { get; }
///
- /// Gets the device attributes
+ /// Gets the device attributes.
///
public IccDeviceAttribute DeviceAttributes { get; }
///
- /// Gets the technology information
+ /// Gets the technology information.
///
public IccProfileTag TechnologyInformation { get; }
///
- /// Gets the device manufacturer info
+ /// Gets the device manufacturer info.
///
public IccLocalizedString[] DeviceManufacturerInfo { get; }
///
- /// Gets the device model info
+ /// Gets the device model info.
///
public IccLocalizedString[] DeviceModelInfo { get; }
///
- public bool Equals(IccProfileDescription other)
- {
- if (other == null)
- {
- return false;
- }
-
- if (ReferenceEquals(this, other))
- {
- return true;
- }
-
- return this.DeviceManufacturer == other.DeviceManufacturer
- && this.DeviceModel == other.DeviceModel
- && this.DeviceAttributes == other.DeviceAttributes
- && this.TechnologyInformation == other.TechnologyInformation
- && this.DeviceManufacturerInfo.SequenceEqual(other.DeviceManufacturerInfo)
- && this.DeviceModelInfo.SequenceEqual(other.DeviceModelInfo);
- }
+ public bool Equals(IccProfileDescription other) =>
+ this.DeviceManufacturer == other.DeviceManufacturer &&
+ this.DeviceModel == other.DeviceModel &&
+ this.DeviceAttributes == other.DeviceAttributes &&
+ this.TechnologyInformation == other.TechnologyInformation &&
+ this.DeviceManufacturerInfo.SequenceEqual(other.DeviceManufacturerInfo) &&
+ this.DeviceModelInfo.SequenceEqual(other.DeviceModelInfo);
///
public override bool Equals(object obj)
{
- if (obj == null)
- {
- return false;
- }
-
- if (ReferenceEquals(this, obj))
- {
- return true;
- }
-
return obj is IccProfileDescription other && this.Equals(other);
}