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


C# Binder.SelectProperty方法代码示例

本文整理汇总了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);
		}
开发者ID:ramonsmits,项目名称:mono,代码行数:20,代码来源:MonoType.cs

示例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);
 }
开发者ID:ArildF,项目名称:masters,代码行数:31,代码来源:runtimetype.cs

示例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);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:34,代码来源:ScriptObject.cs

示例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);
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:14,代码来源:scriptobject.cs


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