Skip to content

Replace IEquatable<> with IMatch<> #43

@ENikS

Description

@ENikS

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions