本文整理汇总了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);
}
示例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];
}
}
示例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);
}
}
示例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
);
}
);
}
示例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>() )
)
);
}