Make RequiredAttributeDescriptor IEquatable.
- All the other descriptors are already `IEquatable` this should be as well. - Moved the required attribute descriptor comparer from Legacy => Language. It wasn't in the Legacy folder to begin with so this made sense given that it's already internal. #1495
This commit is contained in:
parent
4654997201
commit
8090216dbe
|
|
@ -9,7 +9,7 @@ using System.Linq;
|
||||||
namespace Microsoft.AspNetCore.Razor.Language
|
namespace Microsoft.AspNetCore.Razor.Language
|
||||||
{
|
{
|
||||||
[DebuggerDisplay("{DisplayName,nq}")]
|
[DebuggerDisplay("{DisplayName,nq}")]
|
||||||
public abstract class RequiredAttributeDescriptor
|
public abstract class RequiredAttributeDescriptor : IEquatable<RequiredAttributeDescriptor>
|
||||||
{
|
{
|
||||||
public string Name { get; protected set; }
|
public string Name { get; protected set; }
|
||||||
|
|
||||||
|
|
@ -33,6 +33,21 @@ namespace Microsoft.AspNetCore.Razor.Language
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool Equals(RequiredAttributeDescriptor other)
|
||||||
|
{
|
||||||
|
return RequiredAttributeDescriptorComparer.Default.Equals(this, other);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
return Equals(obj as RequiredAttributeDescriptor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return RequiredAttributeDescriptorComparer.Default.GetHashCode(this);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Acceptable <see cref="RequiredAttributeDescriptor.Name"/> comparison modes.
|
/// Acceptable <see cref="RequiredAttributeDescriptor.Name"/> comparison modes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.Extensions.Internal;
|
using Microsoft.Extensions.Internal;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
namespace Microsoft.AspNetCore.Razor.Language
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An <see cref="IEqualityComparer{TagHelperRequiredAttributeDescriptor}"/> used to check equality between
|
/// An <see cref="IEqualityComparer{TagHelperRequiredAttributeDescriptor}"/> used to check equality between
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue