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

Loading…
Cancel
Save