Mega Code Archive

 
Categories / C# / Collections Data Structure
 

Compare two Lists

//  ------------------------------------------------------------------------------------------- //  Copyright (c) 2009 Hanif Virani. All rights reserved. //  This source code is made available under the terms of the Microsoft Public License (Ms-PL) //  http://www.codeplex.com/Desketary/license //  ------------------------------------------------------------------------------------------- using System; using System.Collections.Generic; namespace Desketary.Util {     public static class Helpers     {         public static bool CompareList<T>(List<T> list1, List<T> list2)         {             bool flag = true;             foreach (T obj in list1)             {                 if( !obj.Equals(list2[list1.IndexOf(obj)]) )                 {                     flag = false;                 }             }             return flag;          }     } }