本文整理汇总了C#中System.Reflection.Binder.SelectProperty方法的典型用法代码示例。如果您正苦于以下问题:C# Binder.SelectProperty方法的具体用法?C# Binder.SelectProperty怎么用?C# Binder.SelectProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.Binder
的用法示例。
在下文中一共展示了Binder.SelectProperty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPropertyImpl
protected override PropertyInfo GetPropertyImpl (string name, BindingFlags bindingAttr,
Binder binder, Type returnType,
Type[] types,
ParameterModifier[] modifiers)
{
bool ignoreCase = ((bindingAttr & BindingFlags.IgnoreCase) != 0);
PropertyInfo [] props = GetPropertiesByName (name, bindingAttr, ignoreCase, this);
int count = props.Length;
if (count == 0)
return null;
if (count == 1 && (types == null || types.Length == 0) &&
(returnType == null || returnType == props[0].PropertyType))
return props [0];
if (binder == null)
binder = Binder.DefaultBinder;
return binder.SelectProperty (bindingAttr, props, returnType, types, modifiers);
}
示例2: GetPropertyImpl
// Return a property based upon the passed criteria. The nameof the
// parameter must be provided.
protected override PropertyInfo GetPropertyImpl(String name,BindingFlags bindingAttr,Binder binder,
Type returnType, Type[] types, ParameterModifier[] modifiers)
{
if (binder == null)
binder = DefaultBinder;
int argCnt = (types != null) ? types.Length : -1;
PropertyInfo[] props = GetMatchingProperties(name,bindingAttr,argCnt,null,true);
if (props == null)
return null;
if (argCnt <= 0) {
// no arguments
if (props.Length == 1) {
if (returnType != null && returnType != props[0].PropertyType)
return null;
return props[0];
}
else {
if (returnType == null)
// if we are here we have no args or property type to select over and we have more than one property with that name
throw new AmbiguousMatchException(Environment.GetResourceString("RFLCT.Ambiguous"));
}
}
if ((bindingAttr & BindingFlags.ExactBinding) != 0)
return System.DefaultBinder.ExactPropertyBinding(props,returnType,types,modifiers);
return binder.SelectProperty(bindingAttr,props,returnType,types,modifiers);
}
示例3: GetProperty
public PropertyInfo GetProperty(string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
{
MemberInfo[] member = this.GetMember(name, bindingAttr);
if (member.Length == 1)
{
return (member[0] as PropertyInfo);
}
int num = 0;
foreach (MemberInfo info in member)
{
if (info.MemberType == MemberTypes.Property)
{
num++;
}
}
if (num == 0)
{
return null;
}
PropertyInfo[] match = new PropertyInfo[num];
num = 0;
foreach (MemberInfo info2 in member)
{
if (info2.MemberType == MemberTypes.Property)
{
match[num++] = (PropertyInfo) info2;
}
}
if (binder == null)
{
binder = JSBinder.ob;
}
return binder.SelectProperty(bindingAttr, match, returnType, types, modifiers);
}
示例4: GetProperty
public PropertyInfo GetProperty(String name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers){
MemberInfo[] members = this.GetMember(name, bindingAttr);
if (members.Length == 1) return members[0] as PropertyInfo;
int propertyCount = 0;
foreach (MemberInfo member in members)
if (member.MemberType == MemberTypes.Property) propertyCount++;
if (propertyCount == 0) return null;
PropertyInfo[] properties = new PropertyInfo[propertyCount];
propertyCount = 0;
foreach (MemberInfo member in members)
if (member.MemberType == MemberTypes.Property) properties[propertyCount++] = (PropertyInfo)member;
if (binder == null) binder = JSBinder.ob;
return (PropertyInfo)binder.SelectProperty(bindingAttr, properties, returnType, types, modifiers);
}