Browse Source

Make IccLocalizedString a struct

pull/541/head
Jason Nelson 8 years ago
parent
commit
f492eaa8c4
  1. 25
      src/ImageSharp/MetaData/Profiles/ICC/Various/IccLocalizedString.cs

25
src/ImageSharp/MetaData/Profiles/ICC/Various/IccLocalizedString.cs

@ -7,12 +7,12 @@ using System.Globalization;
namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
/// <summary>
/// A string with a specific locale
/// A string with a specific locale.
/// </summary>
internal sealed class IccLocalizedString : IEquatable<IccLocalizedString>
internal readonly struct IccLocalizedString : IEquatable<IccLocalizedString>
{
/// <summary>
/// Initializes a new instance of the <see cref="IccLocalizedString"/> class.
/// Initializes a new instance of the <see cref="IccLocalizedString"/> struct.
/// The culture will be <see cref="CultureInfo.CurrentCulture"/>
/// </summary>
/// <param name="text">The text value of this string</param>
@ -22,7 +22,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
/// <summary>
/// Initializes a new instance of the <see cref="IccLocalizedString"/> class.
/// Initializes a new instance of the <see cref="IccLocalizedString"/> struct.
/// The culture will be <see cref="CultureInfo.CurrentCulture"/>
/// </summary>
/// <param name="culture">The culture of this string</param>
@ -37,26 +37,19 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
/// <summary>
/// Gets the actual text value
/// Gets the text value.
/// </summary>
public string Text { get; }
/// <summary>
/// Gets the culture of the text
/// Gets the culture of text.
/// </summary>
public CultureInfo Culture { get; }
/// <inheritdoc />
public bool Equals(IccLocalizedString other)
{
if (ReferenceEquals(this, other))
{
return true;
}
return this.Culture.Equals(other.Culture)
&& this.Text == other.Text;
}
public bool Equals(IccLocalizedString other) =>
this.Culture.Equals(other.Culture) &&
this.Text == other.Text;
/// <inheritdoc />
public override string ToString()

Loading…
Cancel
Save