Exemplo n.º 1
0
        public static List <MemberInfo> GetFieldsAndProperties(Type type, BindingFlags bindingAttr)
        {
            List <MemberInfo> memberInfos = new List <MemberInfo>();

            memberInfos.AddRange(ReflectionUtils.GetFields(type, bindingAttr));
            memberInfos.AddRange(ReflectionUtils.GetProperties(type, bindingAttr));
            List <MemberInfo> memberInfos1 = new List <MemberInfo>(memberInfos.Count);
            var name =
                from m in memberInfos
                group m by m.Name into g
                select new { Count = g.Count <MemberInfo>(), Members = g.Cast <MemberInfo>() };

            foreach (var variable in name)
            {
                if (variable.Count != 1)
                {
                    IEnumerable <MemberInfo> members =
                        from m in variable.Members
                        where (!ReflectionUtils.IsOverridenGenericMember(m, bindingAttr) ? true : m.Name == "Item")
                        select m;
                    memberInfos1.AddRange(members);
                }
                else
                {
                    memberInfos1.Add(variable.Members.First <MemberInfo>());
                }
            }
            return(memberInfos1);
        }
Exemplo n.º 2
0
        public static List <MemberInfo> GetFieldsAndProperties(Type type, BindingFlags bindingAttr)
        {
            List <MemberInfo> list1 = new List <MemberInfo>();

            CollectionUtils.AddRange((IList)list1, (IEnumerable)ReflectionUtils.GetFields(type, bindingAttr));
            CollectionUtils.AddRange((IList)list1, (IEnumerable)ReflectionUtils.GetProperties(type, bindingAttr));
            List <MemberInfo> list2 = new List <MemberInfo>(list1.Count);

            foreach (IGrouping <string, MemberInfo> grouping in Enumerable.GroupBy <MemberInfo, string>((IEnumerable <MemberInfo>)list1, (Func <MemberInfo, string>)(m => m.Name)))
            {
                int num = Enumerable.Count <MemberInfo>((IEnumerable <MemberInfo>)grouping);
                IList <MemberInfo> list3 = (IList <MemberInfo>)Enumerable.ToList <MemberInfo>((IEnumerable <MemberInfo>)grouping);
                if (num == 1)
                {
                    list2.Add(Enumerable.First <MemberInfo>((IEnumerable <MemberInfo>)list3));
                }
                else
                {
                    IEnumerable <MemberInfo> collection = Enumerable.Where <MemberInfo>((IEnumerable <MemberInfo>)list3, (Func <MemberInfo, bool>)(m =>
                    {
                        if (ReflectionUtils.IsOverridenGenericMember(m, bindingAttr))
                        {
                            return(m.Name == "Item");
                        }
                        else
                        {
                            return(true);
                        }
                    }));
                    list2.AddRange(collection);
                }
            }
            return(list2);
        }
Exemplo n.º 3
0
        public static List <MemberInfo> GetFieldsAndProperties(Type type, BindingFlags bindingAttr)
        {
            List <MemberInfo> memberInfos = new List <MemberInfo>();

            memberInfos.AddRange <MemberInfo>(ReflectionUtils.GetFields(type, bindingAttr));
            memberInfos.AddRange <MemberInfo>(ReflectionUtils.GetProperties(type, bindingAttr));
            List <MemberInfo> memberInfos1 = new List <MemberInfo>(memberInfos.Count);

            foreach (IGrouping <string, MemberInfo> strs in
                     from m in memberInfos
                     group m by m.Name)
            {
                int num = strs.Count <MemberInfo>();
                IList <MemberInfo> list = strs.ToList <MemberInfo>();
                if (num != 1)
                {
                    IList <MemberInfo> memberInfos2 = new List <MemberInfo>();
                    foreach (MemberInfo memberInfo in list)
                    {
                        if (memberInfos2.Count != 0)
                        {
                            if (ReflectionUtils.IsOverridenGenericMember(memberInfo, bindingAttr) && !(memberInfo.Name == "Item"))
                            {
                                continue;
                            }
                            memberInfos2.Add(memberInfo);
                        }
                        else
                        {
                            memberInfos2.Add(memberInfo);
                        }
                    }
                    memberInfos1.AddRange(memberInfos2);
                }
                else
                {
                    memberInfos1.Add(list.First <MemberInfo>());
                }
            }
            return(memberInfos1);
        }
Exemplo n.º 4
0
        public static List <MemberInfo> GetFieldsAndProperties(Type type, BindingFlags bindingAttr)
        {
            List <MemberInfo> memberInfos = new List <MemberInfo>();

            memberInfos.AddRange(ReflectionUtils.GetFields(type, bindingAttr));
            memberInfos.AddRange(ReflectionUtils.GetProperties(type, bindingAttr));
            List <MemberInfo> memberInfos1 = new List <MemberInfo>(memberInfos.Count);

            foreach (IGrouping <string, MemberInfo> strs in
                     from m in memberInfos
                     group m by m.Name)
            {
                if (strs.Count <MemberInfo>() != 1)
                {
                    List <MemberInfo> memberInfos2 = new List <MemberInfo>();
                    foreach (MemberInfo memberInfo in strs)
                    {
                        if (memberInfos2.Count != 0)
                        {
                            if (ReflectionUtils.IsOverridenGenericMember(memberInfo, bindingAttr) && !(memberInfo.Name == "Item") || memberInfos2.Any <MemberInfo>((MemberInfo m) => m.DeclaringType == memberInfo.DeclaringType))
                            {
                                continue;
                            }
                            memberInfos2.Add(memberInfo);
                        }
                        else
                        {
                            memberInfos2.Add(memberInfo);
                        }
                    }
                    memberInfos1.AddRange(memberInfos2);
                }
                else
                {
                    memberInfos1.Add(strs.First <MemberInfo>());
                }
            }
            return(memberInfos1);
        }
Exemplo n.º 5
0
        // Token: 0x06000E37 RID: 3639 RVA: 0x00052190 File Offset: 0x00050390
        public static List <MemberInfo> GetFieldsAndProperties(Type type, BindingFlags bindingAttr)
        {
            List <MemberInfo> list = new List <MemberInfo>();

            list.AddRange(ReflectionUtils.GetFields(type, bindingAttr));
            list.AddRange(ReflectionUtils.GetProperties(type, bindingAttr));
            List <MemberInfo> list2 = new List <MemberInfo>(list.Count);

            foreach (IGrouping <string, MemberInfo> grouping in from m in list
                     group m by m.Name)
            {
                if (grouping.Count <MemberInfo>() == 1)
                {
                    list2.Add(grouping.First <MemberInfo>());
                }
                else
                {
                    List <MemberInfo> list3 = new List <MemberInfo>();
                    using (IEnumerator <MemberInfo> enumerator2 = grouping.GetEnumerator())
                    {
                        while (enumerator2.MoveNext())
                        {
                            MemberInfo memberInfo = enumerator2.Current;
                            if (list3.Count == 0)
                            {
                                list3.Add(memberInfo);
                            }
                            else if ((!ReflectionUtils.IsOverridenGenericMember(memberInfo, bindingAttr) || memberInfo.Name == "Item") && !list3.Any((MemberInfo m) => m.DeclaringType == memberInfo.DeclaringType))
                            {
                                list3.Add(memberInfo);
                            }
                        }
                    }
                    list2.AddRange(list3);
                }
            }
            return(list2);
        }
Exemplo n.º 6
0
        public static List <MemberInfo> GetFieldsAndProperties(
            Type type,
            BindingFlags bindingAttr)
        {
            List <MemberInfo> memberInfoList1 = new List <MemberInfo>();

            memberInfoList1.AddRange <MemberInfo>((IEnumerable)ReflectionUtils.GetFields(type, bindingAttr));
            memberInfoList1.AddRange <MemberInfo>((IEnumerable)ReflectionUtils.GetProperties(type, bindingAttr));
            List <MemberInfo> memberInfoList2 = new List <MemberInfo>(memberInfoList1.Count);

            foreach (IGrouping <string, MemberInfo> source in memberInfoList1.GroupBy <MemberInfo, string>((Func <MemberInfo, string>)(m => m.Name)))
            {
                int num = source.Count <MemberInfo>();
                IList <MemberInfo> list = (IList <MemberInfo>)source.ToList <MemberInfo>();
                if (num == 1)
                {
                    memberInfoList2.Add(list.First <MemberInfo>());
                }
                else
                {
                    IList <MemberInfo> memberInfoList3 = (IList <MemberInfo>) new List <MemberInfo>();
                    foreach (MemberInfo memberInfo in (IEnumerable <MemberInfo>)list)
                    {
                        if (memberInfoList3.Count == 0)
                        {
                            memberInfoList3.Add(memberInfo);
                        }
                        else if (!ReflectionUtils.IsOverridenGenericMember(memberInfo, bindingAttr) || memberInfo.Name == "Item")
                        {
                            memberInfoList3.Add(memberInfo);
                        }
                    }
                    memberInfoList2.AddRange((IEnumerable <MemberInfo>)memberInfoList3);
                }
            }
            return(memberInfoList2);
        }
        public static List <MemberInfo> GetFieldsAndProperties(Type type, BindingFlags bindingAttr)
        {
            List <MemberInfo> list = new List <MemberInfo>();

            list.AddRange(ReflectionUtils.GetFields(type, bindingAttr));
            list.AddRange(ReflectionUtils.GetProperties(type, bindingAttr));
            List <MemberInfo> list2 = new List <MemberInfo>(list.get_Count());
            var enumerable          = Enumerable.Select(Enumerable.GroupBy <MemberInfo, string>(list, (MemberInfo m) => m.get_Name()), (IGrouping <string, MemberInfo> g) => new
            {
                Count   = Enumerable.Count <MemberInfo>(g),
                Members = Enumerable.Cast <MemberInfo>(g)
            });

            using (var enumerator = enumerable.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    var current = enumerator.get_Current();
                    if (current.Count == 1)
                    {
                        list2.Add(Enumerable.First <MemberInfo>(current.Members));
                    }
                    else
                    {
                        IEnumerable <MemberInfo> enumerable2 = Enumerable.Where <MemberInfo>(current.Members, (MemberInfo m) => !ReflectionUtils.IsOverridenGenericMember(m, bindingAttr) || m.get_Name() == "Item");
                        list2.AddRange(enumerable2);
                    }
                }
            }
            return(list2);
        }
Exemplo n.º 8
0
        public static List <MemberInfo> GetFieldsAndProperties(Type type, BindingFlags bindingAttr)
        {
            List <MemberInfo> list = new List <MemberInfo>();

            list.AddRange(ReflectionUtils.GetFields(type, bindingAttr));
            list.AddRange(ReflectionUtils.GetProperties(type, bindingAttr));
            List <MemberInfo> list2 = new List <MemberInfo>(list.Count);

            foreach (IGrouping <string, MemberInfo> current in from m in list
                     group m by m.Name)
            {
                int num = current.Count <MemberInfo>();
                IList <MemberInfo> source = current.ToList <MemberInfo>();
                if (num == 1)
                {
                    list2.Add(source.First <MemberInfo>());
                }
                else
                {
                    IEnumerable <MemberInfo> collection = source.Where((MemberInfo m) => !ReflectionUtils.IsOverridenGenericMember(m, bindingAttr) || m.Name == "Item");
                    list2.AddRange(collection);
                }
            }
            return(list2);
        }