123456789101112131415161718192021222324252627282930313233 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp1.Else
- {
- internal class EnumerableSequenceEqualTest
- {
- public static void Test()
- {
- var a = new Dictionary<string, string>() {
- { "0", "1" },
- { "2", "3" }
- };
- var b = new Dictionary<string, string>() {
- { "2", "3" },
- { "0", "1" }
- };
- var equl = CheckIsEqual(a, b);
- }
- private static bool CheckIsEqual(Dictionary<string, string> d1, Dictionary<string, string> d2)
- {
- return d1.Count == d2.Count && d1.All(
- (d1KV) => d2.TryGetValue(d1KV.Key, out var d2Value) && (
- d1KV.Value == d2Value ||
- d1KV.Value?.Equals(d2Value) == true)
- );
- }
- }
- }
|