Browse Source

Initialize is only needed in the constructor. It would just return on the other invocations

pull/2330/head
Stefan Nikolei 4 years ago
parent
commit
2d6c174606
  1. 13
      src/ImageSharp/Metadata/Profiles/IPTC/IptcProfile.cs

13
src/ImageSharp/Metadata/Profiles/IPTC/IptcProfile.cs

@ -78,14 +78,7 @@ public sealed class IptcProfile : IDeepCloneable<IptcProfile>
/// <summary> /// <summary>
/// Gets the values of this iptc profile. /// Gets the values of this iptc profile.
/// </summary> /// </summary>
public IEnumerable<IptcValue> Values public IEnumerable<IptcValue> Values => this.values;
{
get
{
this.Initialize();
return this.values;
}
}
/// <inheritdoc/> /// <inheritdoc/>
public IptcProfile DeepClone() => new(this); public IptcProfile DeepClone() => new(this);
@ -116,8 +109,6 @@ public sealed class IptcProfile : IDeepCloneable<IptcProfile>
/// <returns>True when the value was found and removed.</returns> /// <returns>True when the value was found and removed.</returns>
public bool RemoveValue(IptcTag tag) public bool RemoveValue(IptcTag tag)
{ {
this.Initialize();
bool removed = false; bool removed = false;
for (int i = this.values.Count - 1; i >= 0; i--) for (int i = this.values.Count - 1; i >= 0; i--)
{ {
@ -139,8 +130,6 @@ public sealed class IptcProfile : IDeepCloneable<IptcProfile>
/// <returns>True when the value was found and removed.</returns> /// <returns>True when the value was found and removed.</returns>
public bool RemoveValue(IptcTag tag, string value) public bool RemoveValue(IptcTag tag, string value)
{ {
this.Initialize();
bool removed = false; bool removed = false;
for (int i = this.values.Count - 1; i >= 0; i--) for (int i = this.values.Count - 1; i >= 0; i--)
{ {

Loading…
Cancel
Save