Equals

public static bool Equals<T, TResult>(this T obj, object obj1, Func<T, TResult> selector)
        {
            return obj1 is T && selector(obj).Equals(selector((T)obj1));
        }
Example:
When used inside a custom "File" class: public override bool Equals(object obj)
        {
            return this.Equals(obj, x => x.Path);
        }

Description

Equals method that lets you specify on what property or field value you want to compare an object on. Also compares the object types. Useful to use in an overridden Equals method of an object.

Details

Double click on the code to select all.

 

;