示例#1
0
文件: ListX.cs 项目: chenmsg/sujin
        /// <summary>
        /// 集合相加
        /// </summary>
        /// <param name="list1">第一个实体集合</param>
        /// <param name="list2">第二个实体集合</param>
        /// <returns></returns>
        public static ListX <T> operator +(ListX <T> list1, ListX <T> list2)
        {
            if (list1 == null || list1.Count < 1)
            {
                return(list2);
            }
            else
            {
                if (list2 == null || list2.Count < 1)
                {
                    return(list1);
                }
                else
                {
                    ListX <T> list = new ListX <T>();
                    list.AddRange(list1);
                    list.AddRange(list2);

                    return(list);
                }
            }

            //if ((list1 == null || list1.Count < 1) && (list2 == null || list2.Count < 1)) return null;

            //ListX<T> list = new ListX<T>();
            //if (list1 != null && list1.Count > 0) list.AddRange(list1);
            //if (list2 != null && list2.Count > 0) list.AddRange(list2);

            //return list;
        }
示例#2
0
        /// <summary>
        /// 查找所有非系统程序集中的所有插件
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static ListX <Type> FindAllPlugins(Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            ListX <AssemblyX> asms = GetAssemblies();
            ListX <Type>      list = new ListX <Type>();

            foreach (AssemblyX item in asms)
            {
                if (item.IsSystemAssembly)
                {
                    continue;
                }

                ListX <Type> ts = item.FindPlugins(type);
                if (ts != null && ts.Count > 0)
                {
                    list.AddRange(ts);
                }
            }
            return(list.Count > 0 ? list : null);
        }