I have a class :
public class Person
{
public string name { get; set; }
public int age { get; set; }
}
Person p1 = new Person() { age=1, name="a" };
Person p2 = new Person() { age = 1, name = "b" };
I want to do something like
p1.equals(p2)
but by age or by name
I don’t mean in a way of adding to dictionary ( and use Iequatable…)
the Equals method Doesnt take any Helper inside it …

is there any way that i can send him my specific helper class just like :
Dictionary<PersonForDictionary, int> dct2 =
new Dictionary<PersonForDictionary, int>(new helperClass()); // here helperclass is a class which I gave him - and told the dictionary how to equate objects....
Im looking for a similar solution when equating objects. ( not in dictionary mode).
Could be, may be also like make different implementations of
IComparable.For example:
after implement different classes:
or another
and use it inside: