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


C# MemberInfo.Select方法代码示例

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


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

示例1: Field

        protected Field(MemberInfo[] members)
        {
            Members = members;
            MemberName = members.Select(x => x.Name).Join("");

            MemberType = members.Last().GetMemberType();

            PgType = TypeMappings.GetPgType(MemberType);
        }
开发者ID:danielmarbach,项目名称:marten,代码行数:9,代码来源:Field.cs

示例2: Field

        protected Field(MemberInfo[] members)
        {
            Members = members;
            MemberName = members.Select(x => x.Name).Join("");

            MemberType = members.Last().GetMemberType();

            if (MemberType.IsEnum)
            {
                PgType = "integer";
            }
            else
            {
                PgType = TypeMappings.PgTypes[MemberType];
            }
        }
开发者ID:jjchiw,项目名称:Marten,代码行数:16,代码来源:Field.cs

示例3: 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

示例4: GetSystemRuntimeSerializationCompatibleMembers

		private static IEnumerable<SerializingMember> GetSystemRuntimeSerializationCompatibleMembers( MemberInfo[] members )
		{
			return
				members.Select(
					item =>
						new
						{
							member = item,
							data = 
								item.GetCustomAttributesData()
								.FirstOrDefault(
									data => data.GetAttributeType().FullName == "System.Runtime.Serialization.DataMemberAttribute" 
								)
						}
					).Where( item => item.data != null )
					.Select(
						item =>
						{
							var name = 
								item.data.GetNamedArguments()
								.Where( arg => arg.GetMemberName() == "Name" )
								.Select( arg => ( string ) arg.GetTypedValue().Value )
								.FirstOrDefault();
							var id = 
								item.data.GetNamedArguments()
								.Where( arg => arg.GetMemberName() == "Order" )
#if !UNITY
								.Select( arg => ( int? )arg.GetTypedValue().Value )
#else
								.Select( arg => arg.GetTypedValue().Value )
#endif
								.FirstOrDefault();
#if SILVERLIGHT
							if ( id == -1 )
							{
								// Shim for Silverlight returns -1 because GetNamedArguments() extension method cannot recognize whether the argument was actually specified or not.
								id = null;
							}
#endif // SILVERLIGHT

							return
								new SerializingMember(
									item.member,
#if !UNITY
									new DataMemberContract( item.member, name, NilImplication.MemberDefault, id )
#else
									new DataMemberContract( item.member, name, NilImplication.MemberDefault, ( int? )id )
#endif // !UNITY
								);
						}
					);
		}
开发者ID:josiahdecker,项目名称:msgpack-cli,代码行数:52,代码来源:SerializationTarget.cs

示例5: GetAnnotatedMembersWithDuplicationDetection

		private static IEnumerable<SerializingMember> GetAnnotatedMembersWithDuplicationDetection( Type type, MemberInfo[] filtered )
		{
			var duplicated =
				filtered.FirstOrDefault(
					member => member.IsDefined( typeof( MessagePackIgnoreAttribute ) )
					);

			if ( duplicated != null )
			{
				throw new SerializationException(
					String.Format(
						CultureInfo.CurrentCulture,
						"A member '{0}' of type '{1}' is marked with both MessagePackMemberAttribute and MessagePackIgnoreAttribute.",
						duplicated.Name,
						type
						)
					);
			}

			return
				filtered.Select(
					member =>
						new SerializingMember(
							member,
							new DataMemberContract( member, member.GetCustomAttribute<MessagePackMemberAttribute>() )
							)
					);
		}
开发者ID:josiahdecker,项目名称:msgpack-cli,代码行数:28,代码来源:SerializationTarget.cs


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