DeepEqual icon indicating copy to clipboard operation
DeepEqual copied to clipboard

Comparison of KeyValuePair types

Open DrastamatSargsyan opened this issue 4 years ago • 1 comments

Found an issue - IsDeepEqueal() method returns false as the comparison result of exact KeyValuePair objects. That's working well when I'm using KeyValuePair with primitive types, but not working with my other defined types.

public class Model
{
    public int Id { get; set; }
    public string Name { get; set; }
}

class Program
{
    static void Main(string[] args)
    {
        var model_1 = new KeyValuePair<string, Model>("1", new Model() { Id = 10, Name = "1" });
        var model_2 = new KeyValuePair<string, Model>("1", new Model() { Id = 10, Name = "1" });

        var model_3 = new KeyValuePair<int, string>(1, "1");
        var model_4 = new KeyValuePair<int, string>(1, "1");

        Console.WriteLine(model_1.IsDeepEqual(model_2));
        Console.WriteLine(model_3.IsDeepEqual(model_4));
    }                                         
}

DrastamatSargsyan avatar Dec 02 '20 16:12 DrastamatSargsyan

@jamesfoster I'd like to take a look at it - are you ok with that?

rokklobster avatar Jan 22 '21 12:01 rokklobster

Will be released in version 4.0.0

jamesfoster avatar Aug 20 '22 13:08 jamesfoster