Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List<string> l1 = new List<string> {"Hello", "World","How","Are","You"};
- List<string> l2 = new List<string> {"Hello","World","How","Are","You"};
- Console.WriteLine(l1.SequenceEqual(l2));
- public static bool CompareLists(List<int> l1, List<int> l2)
- {
- if (l1 == l2) return true;
- if (l1.Count != l2.Count) return false;
- for (int i=0; i<l1.Count; i++)
- if (l1[i] != l2[i]) return false;
- return true;
- }
- public static CompareList<T>(IList<T> obj1, IList<T> obj2, Action<T,T> match)
- {
- if (obj1.Count != obj2.Count) return false;
- for (int i = 0; i < obj1.Count; i++)
- {
- if (obj2[i] != null && !match(obj1[i], obj2[i]))
- return false;
- }
- }
- var testList = userInput.match(/[-|w]+/g)
- /*the above catches common errors:
- using dash or starting with a numeric*/
- listToUse = userInput.match(/[a-zA-Z]w*/g)
- if (listToUse.join(" ") != testList.join(" ")) {
- return "the lists don't match"
Add Comment
Please, Sign In to add comment