41 lines
1.1 KiB
C#
41 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace EgwControlCenter.Core
|
|
{
|
|
public class Utils
|
|
{
|
|
/// <summary>
|
|
/// Comparazione tra 2 dizionari
|
|
/// </summary>
|
|
/// <param name="dict1"></param>
|
|
/// <param name="dict2"></param>
|
|
/// <returns></returns>
|
|
public static bool CompareDict(Dictionary<string,string> dict1, Dictionary<string,string> dict2)
|
|
{
|
|
bool areEqual = true;
|
|
|
|
if (dict1.Count != dict2.Count)
|
|
{
|
|
areEqual = false;
|
|
}
|
|
else
|
|
{
|
|
// ciclo da dict1 ogni valore che so essere in ugual numero in dict2
|
|
foreach (var kvp in dict1)
|
|
{
|
|
if (!dict2.TryGetValue(kvp.Key, out string? value) || value != kvp.Value)
|
|
{
|
|
areEqual = false;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
return areEqual;
|
|
}
|
|
}
|
|
}
|