Skip to content

Commit

Permalink
Redundant XML comments replaced with <inheritdoc />
Browse files Browse the repository at this point in the history
  • Loading branch information
dotnetjunkie committed Apr 26, 2019
1 parent 551a2fa commit 697c628
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 50 deletions.
13 changes: 3 additions & 10 deletions src/SimpleInjector/Advanced/InstanceInitializationData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,16 @@ public InstanceInitializationData(InitializerContext context, object instance)
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
internal string DebuggerDisplay => this.Context.DebuggerDisplay;

/// <summary>Returns the hash code for this instance.</summary>
/// <returns>A 32-bit signed integer that is the hash code for this instance.</returns>
/// <inheritdoc />
public override int GetHashCode() =>
(this.Context == null ? 0 : this.Context.GetHashCode()) ^
(this.Instance == null ? 0 : this.Instance.GetHashCode());

/// <summary>Indicates whether this instance and a specified object are equal.</summary>
/// <param name="obj">Another object to compare to.</param>
/// <returns>True if the current object is equal to the other parameter; otherwise, false.</returns>
/// <inheritdoc />
public override bool Equals(object obj) =>
obj is InstanceInitializationData && this.Equals((InstanceInitializationData)obj);

/// <summary>
/// Indicates whether the current object is equal to another object of the same type.
/// </summary>
/// <param name="other">An object to compare with this object.</param>
/// <returns>True if the current object is equal to the other parameter; otherwise, false.</returns>
/// <inheritdoc />
public bool Equals(InstanceInitializationData other) => this == other;

/// <summary>
Expand Down
17 changes: 3 additions & 14 deletions src/SimpleInjector/Advanced/KnownRelationship.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,28 +106,17 @@ public sealed class KnownRelationship : IEquatable<KnownRelationship>
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private string ImplementationTypeDebuggerDisplay => this.ImplementationType.ToFriendlyName();

/// <summary>Serves as a hash function for a particular type.</summary>
/// <returns>A hash code for the current <see cref="KnownRelationship"/>.</returns>
/// <inheritdoc />
public override int GetHashCode() =>
this.ImplementationType.GetHashCode()
^ this.Lifestyle.GetHashCode()
^ this.Consumer?.GetHashCode() ?? 0
^ this.Dependency.GetHashCode();

/// <summary>
/// Determines whether the specified object is equal to the current object.
/// </summary>
/// <param name="obj">The object to compare with the current object.</param>
/// <returns>true if the specified object is equal to the current object; otherwise, false.</returns>
/// <inheritdoc />
public override bool Equals(object obj) => this.Equals(obj as KnownRelationship);

/// <summary>
/// Determines whether the specified <see cref="KnownRelationship"/> is equal to the current
/// <see cref="KnownRelationship"/>.
/// </summary>
/// <param name="other">The object to compare with the current object.</param>
/// <returns>True if the specified <see cref="KnownRelationship"/> is equal to the current
/// <see cref="KnownRelationship"/>; otherwise, false.</returns>
/// <inheritdoc />
public bool Equals(KnownRelationship other)
{
if (other == null)
Expand Down
18 changes: 4 additions & 14 deletions src/SimpleInjector/InjectionConsumerInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,29 +84,19 @@ public Type ServiceType
/// <value>The <see cref="InjectionTargetInfo"/> for this context.</value>
public InjectionTargetInfo Target { get; }

/// <summary>Serves as a hash function for a particular type.</summary>
/// <returns>A hash code for the current <see cref="InjectionConsumerInfo"/>.</returns>
/// <inheritdoc />
public override int GetHashCode() =>
this.ImplementationType.GetHashCode() ^ this.Target.GetHashCode();

/// <summary>
/// Determines whether the specified object is equal to the current object.
/// </summary>
/// <param name="obj">The object to compare with the current object.</param>
/// <returns>true if the specified object is equal to the current object; otherwise, false.</returns>
/// <inheritdoc />
public override bool Equals(object obj) => this.Equals(obj as InjectionConsumerInfo);

/// <summary>
/// Indicates whether the current object is equal to another object of the same type.
/// </summary>
/// <param name="other">An object to compare with this object.</param>
/// <returns>true if the current object is equal to the other parameter; otherwise, false.</returns>
/// <inheritdoc />
public bool Equals(InjectionConsumerInfo other) =>
this.ImplementationType.Equals(other.ImplementationType)
&& this.Target.Equals(other.Target);

/// <summary>Returns a string that represents the <see cref="InjectionConsumerInfo"/>.</summary>
/// <returns>A string.</returns>
/// <inheritdoc />
public override string ToString() =>
"{ ImplementationType: " + this.ImplementationType.ToFriendlyName() +
", Target.Name: '" + this.Target.Name + "' }";
Expand Down
15 changes: 3 additions & 12 deletions src/SimpleInjector/InjectionTargetInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,24 +191,15 @@ internal InjectionTargetInfo(PropertyInfo property)
? this.Parameter.GetCustomAttributes(typeof(T), inherit).Cast<T>()
: this.Property.GetCustomAttributes(typeof(T), inherit).Cast<T>();

/// <summary>Serves as a hash function for a particular type.</summary>
/// <returns>A hash code for the current <see cref="InjectionTargetInfo"/>.</returns>
/// <inheritdoc />
public override int GetHashCode() =>
this.Parameter?.GetHashCode() ?? 0
^ this.Property?.GetHashCode() ?? 0;

/// <summary>
/// Determines whether the specified object is equal to the current object.
/// </summary>
/// <param name="obj">The object to compare with the current object.</param>
/// <returns>true if the specified object is equal to the current object; otherwise, false.</returns>
/// <inheritdoc />
public override bool Equals(object obj) => this.Equals(obj as InjectionTargetInfo);

/// <summary>
/// Indicates whether the current object is equal to another object of the same type.
/// </summary>
/// <param name="other">An object to compare with this object.</param>
/// <returns>true if the current object is equal to the other parameter; otherwise, false.</returns>
/// <inheritdoc />
public bool Equals(InjectionTargetInfo other) =>
this.Parameter != null
? this.Parameter.Equals(other.Parameter)
Expand Down

0 comments on commit 697c628

Please sign in to comment.