We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
internal static class IReadOnlyListEqualByComparer { internal static bool TryGet(Type type, MemberSettings settings, out EqualByComparer comparer) { if (type.Implements(typeof(IReadOnlyList<>))) { if (type.IsArray) { comparer = (EqualByComparer)typeof(ArrayComparer<>).MakeGenericType(type.GetItemType()) .GetField(nameof(ArrayComparer<int>.Default), BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static) .GetValue(null); } else if (type.GetGenericTypeDefinition() == typeof(List<>)) { comparer = (EqualByComparer)typeof(ListComparer<>).MakeGenericType(type.GetItemType()) .GetField(nameof(ListComparer<int>.Default), BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static) .GetValue(null); } else { comparer = (EqualByComparer)typeof(Comparer<>).MakeGenericType(type.GetItemType()) .GetField(nameof(Comparer<int>.Default), BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static) .GetValue(null); } return true; } comparer = null; return false; } [DebuggerDisplay("IReadOnlyListEqualByComparer<IReadOnlyListEqualByComparer<{typeof(T).PrettyName()}>>")] private class Comparer<T> : CollectionEqualByComparer<IReadOnlyList<T>,T> { public static Comparer<T> Default => new Comparer<T>(); private Comparer() { } internal override bool Equals(IReadOnlyList<T> x, IReadOnlyList<T> y, MemberSettings settings, ReferencePairCollection referencePairs) { if (x.Count != y.Count) { return false; } var comparer = this.ItemComparer(settings); for (var i = 0; i < x.Count; i++) { if (!comparer.Equals(x[i], y[i], settings, referencePairs)) { return false; } } return true; } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: