container
container copied to clipboard
Replace IEquatable<> with IMatch<>
Description
Unity Abstractions relies on IEquatable<> to determine compatibility of dependencies with various injected members.
Problem
IEquatable<T> interface implements one method: bool Equals(T? other)
The other parameter is passed as nullable, so before it is used, it needs to be checked for null. Every call to this method adds a null check although it is never null.
Solution
To resolve this issue IEquatable<T> interface should be replaced with custom interface:
public interface IMatch<T>
{
public bool Match(T other);
}
Impact
Custom Injection Members will require refactoring.