container icon indicating copy to clipboard operation
container copied to clipboard

Replace IEquatable<> with IMatch<>

Open ENikS opened this issue 6 years ago • 0 comments

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.

ENikS avatar Jun 14 '20 23:06 ENikS