示例#1
0
        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);
         }
     }
 }
示例#3
0
 static Comparer()
 {
     compfactory = new ComparerFactory();
 }