• ListComparer


        using System;
        using System.Collections;
        using System.Runtime.CompilerServices;

        public static class ListComparer
        {
            public static bool ListsEqual(IList list1, IList list2)
            {
                if (list1.Count != list2.Count)
                {
                    return false;
                }
                for (int i = 0; i < list1.Count; i++)
                {
                    if (list1[i] != list2[i])
                    {
                        return false;
                    }
                }
                return true;
            }

            public static bool ListsEqual(IList list1, IList list2, ObjectCompareDelegate compare)
            {
                if (list1.Count != list2.Count)
                {
                    return false;
                }
                for (int i = 0; i < list1.Count; i++)
                {
                    if (!compare(list1[i], list2[i]))
                    {
                        return false;
                    }
                }
                return true;
            }

            public delegate bool ObjectCompareDelegate(object x, object y);
        }

  • 相关阅读:
    拦截器
    git和bootstrap
    java面试题目
    Struts2笔记
    sql语句的面试题
    公司面试总结
    面试题12 包含 min 函数的栈 【栈】
    面试题11 字符串的排列[算法]
    [面试] 进程和线程的区别(面试题)
    [baidu] 面向对象的三个基本要素和五项基本设计原则
  • 原文地址:https://www.cnblogs.com/bigmouthz/p/1668637.html
Copyright © 2020-2023  润新知