public static bool AreSimilar <T>(T first, T second) { IObjectComparer <T> objComparer; objComparer = ComparerFactory.CreateComparerObject <T>(); bool areSimilar = objComparer.Compare(first, second); return(areSimilar); }
public static bool Compare(object a, object b) { if (a == null || b == null) { return(a == b); } else if (a == b || a.Equals(b)) { return(true); } else { try { IComparer comparer = ComparerFactory.GetComparerInstance(a.GetType()); return(comparer.Compare(a, b)); } catch (Exception) { return(false); } } }
static Comparer() { compfactory = new ComparerFactory(); }