当前位置: 首页>>代码示例>>C#>>正文


C# MemberInfo.Where方法代码示例

本文整理汇总了C#中System.Reflection.MemberInfo.Where方法的典型用法代码示例。如果您正苦于以下问题:C# MemberInfo.Where方法的具体用法?C# MemberInfo.Where怎么用?C# MemberInfo.Where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Reflection.MemberInfo的用法示例。


在下文中一共展示了MemberInfo.Where方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FilterMembers

 private MemberInfo[] FilterMembers(MemberInfo[] members)
 {
     var ignore = new[] {"GetType", "ToString", "CompareTo", "GetTypeCode", "Equals", "GetHashCode"};
     return
         members.Where(
             m =>
             !(m.MemberType == MemberTypes.Constructor || m.MemberType == MemberTypes.NestedType ||
               ignore.Contains(m.Name))).ToArray();
 }
开发者ID:paulbatum,项目名称:storevil,代码行数:9,代码来源:MemberReader.cs

示例2: PropertyDropDown

        private void PropertyDropDown(BindingBase.BindingInfo info)
        {
            var type = Target.Context.DataType;

            var members = new MemberInfo[0];

            // filter
            switch (info.Filters)
            {
                case BindingBase.BindingFilter.Commands:
                    members = EditorMembersHelper.GetMethods(type);
                    break;
                case BindingBase.BindingFilter.Properties:
                    members = EditorMembersHelper.GetProperties(type);
                    break;
            }

            //filter
            if (info.FilterTypes != null)
            {
                members = members.Where(o => info.FilterTypes.Any(t => ValidType(t, o.GetParamaterType()))).ToArray();
            }

            if (members.Length == 0)
            {
                EditorGUILayout.LabelField(string.Format("{0}->{1} has no valid members.", info.BindingName, type.Name));
                return;
            }

            var labels = members.Select(o => string.Format("{0} : {1}", o.Name, o.GetParamaterType())).ToList();

            var names = members.Select(o => o.Name).ToList();

            labels.Insert(0, "Null");
            names.Insert(0, "");

            var index = Array.IndexOf(names.ToArray(), info.MemberName);

            var i = EditorGUILayout.Popup(info.BindingName, index, labels.ToArray());

            if (i != index)
            {
                info.MemberName = names[i];
                EditorUtility.SetDirty(target);
            }
        }
开发者ID:NVentimiglia,项目名称:Unity3d-Foundation,代码行数:46,代码来源:BinderEditor.cs

示例3: GetPublicUnpreventedMembers

		private static IEnumerable<SerializingMember> GetPublicUnpreventedMembers( MemberInfo[] members )
		{
			return members.Where(
				member => member.GetIsPublic()
#if !SILVERLIGHT && !NETFX_CORE
						&& !Attribute.IsDefined( member, typeof( NonSerializedAttribute ) )
#endif // !SILVERLIGHT && !NETFX_CORE
						&& !member.IsDefined( typeof( MessagePackIgnoreAttribute ) ) 
				).Select( member => new SerializingMember( member, new DataMemberContract( member ) ) );
		}
开发者ID:josiahdecker,项目名称:msgpack-cli,代码行数:10,代码来源:SerializationTarget.cs

示例4: AreAccessorsValid

        private static bool AreAccessorsValid(MemberTypes memberType, MemberInfo[] accessors, out string errorMessage)
        {
            errorMessage = string.Empty;
            if (accessors == null)
            {
                errorMessage = Strings.LazyMemberInfo_AccessorsNull;
                return false;
            }

            if (accessors.All(accessor => accessor == null))
            {
                errorMessage = Strings.LazyMemberInfo_NoAccessors;
                return false;
            }

            switch (memberType)
            {
                case MemberTypes.Property:
                    if (accessors.Length != 2)
                    {
                        errorMessage = Strings.LazyMemberInfo_InvalidPropertyAccessors_Cardinality;
                        return false;
                    }

                    if (accessors.Where(accessor => (accessor != null) && (accessor.MemberType != MemberTypes.Method)).Any())
                    {
                        errorMessage = Strings.LazyMemberinfo_InvalidPropertyAccessors_AccessorType;
                        return false;
                    }

                    break;

                case MemberTypes.Event:
                    if (accessors.Length != 3)
                    {
                        errorMessage = Strings.LazyMemberInfo_InvalidEventAccessors_Cardinality;
                        return false;
                    }

                    if (accessors.Where(accessor => (accessor != null) && (accessor.MemberType != MemberTypes.Method)).Any())
                    {
                        errorMessage = Strings.LazyMemberinfo_InvalidEventAccessors_AccessorType;
                        return false;
                    }

                    break;

                default:
                    if (
                        (accessors.Length != 1) ||
                        ((accessors.Length == 1) && (accessors[0].MemberType != memberType)))
                    {
                        errorMessage = string.Format(CultureInfo.CurrentCulture, Strings.LazyMemberInfo_InvalidAccessorOnSimpleMember, memberType);
                        return false;
                    }
                   
                    break;
            }
            return true;
        }
开发者ID:nlhepler,项目名称:mono,代码行数:60,代码来源:LazyMemberInfo.cs

示例5: getPossibleMembers

 /// <summary> 
 /// Filter the not name like, and also if parameters are added, the not methods.
 /// </summary>
 /// <param name="nextNode">The next node.</param>
 /// <param name="initialMembers">The initial members.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns></returns>
 private List<MemberInfo> getPossibleMembers(ExecutionNode nextNode, MemberInfo[] initialMembers, List<object> parameters)
 {
     var possibleMembers = initialMembers.Where(possibleMember => possibleMember.Name.ToLower() == nextNode.executionText.ToLower()).ToList();
     if (parameters.Count > 0)
     {
         List<MemberInfo> replaceList = new List<MemberInfo>();
         foreach (var memberInfo in possibleMembers)
         {
             if (memberInfo.MemberType == MemberTypes.Method)
                 replaceList.Add(memberInfo);
         }
         possibleMembers = replaceList;
     }
     return possibleMembers;
 }
开发者ID:JasperH,项目名称:CSConsole,代码行数:22,代码来源:InterPreter.cs


注:本文中的System.Reflection.MemberInfo.Where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。