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


C# Reflection.Binder类代码示例

本文整理汇总了C#中System.Reflection.Binder的典型用法代码示例。如果您正苦于以下问题:C# Binder类的具体用法?C# Binder怎么用?C# Binder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Binder类属于System.Reflection命名空间,在下文中一共展示了Binder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InternalInvoke

 internal Object InternalInvoke(Object obj,BindingFlags invokeAttr,Binder binder, Object[] parameters,CultureInfo culture, bool verifyAccess)
 {
     // Do they want us to process Default Values?
     if (parameters != null && parameters.Length > 0) {
         int length = parameters.Length;
         ParameterInfo[] p = null;
         for (int i=0;i<length;i++) {
             // if the parameter is missing we need to get a default value.
             if (parameters[i] == Type.Missing) {
                 if (p == null) {
                     p = GetParameters();
                     // If the parameters and the number of parameters passed are 
                     //  not the same then we need to exit.
                     if (p.Length != length)
                         throw new ArgumentException(Environment.GetResourceString("Arg_ParmCnt"),"parameters");
                 }
                 if (p[i].DefaultValue == System.DBNull.Value)
                     throw new ArgumentException(Environment.GetResourceString("Arg_VarMissNull"),"parameters");
                 parameters[i] = p[i].DefaultValue;
             }
         }
         BCLDebug.Assert(this!=null, "[RuntimeMethodInfo.Invoke]this!=null");
         Object[] args = new Object[length];
         for (int index = 0; index < length; index++) 
             args[index] = parameters[index];
         Object retValue = InternalInvoke(obj,invokeAttr,binder,args,culture,binder == Type.DefaultBinder, null, verifyAccess);
         for (int index = 0; index < length; index++) 
             parameters[index] = args[index];
         return retValue;
     }
     return InternalInvoke(obj,invokeAttr,binder,parameters,culture,binder == Type.DefaultBinder, null, verifyAccess);
 }
开发者ID:ArildF,项目名称:masters,代码行数:32,代码来源:runtimemethodinfo.cs

示例2: LocalFunctionSymbol

        public LocalFunctionSymbol(
            Binder binder,
            Symbol containingSymbol,
            LocalFunctionStatementSyntax syntax)
        {
            _syntax = syntax;
            _containingSymbol = containingSymbol;

            _declarationModifiers =
                DeclarationModifiers.Private |
                DeclarationModifiers.Static |
                syntax.Modifiers.ToDeclarationModifiers();

            var diagnostics = DiagnosticBag.GetInstance();

            if (_syntax.TypeParameterList != null)
            {
                binder = new WithMethodTypeParametersBinder(this, binder);
                _typeParameters = MakeTypeParameters(diagnostics);
            }
            else
            {
                _typeParameters = ImmutableArray<TypeParameterSymbol>.Empty;
            }

            if (IsExtensionMethod)
            {
                diagnostics.Add(ErrorCode.ERR_BadExtensionAgg, Locations[0]);
            }

            _binder = binder;
            _refKind = (syntax.ReturnType.Kind() == SyntaxKind.RefType) ? RefKind.Ref : RefKind.None;
            _diagnostics = diagnostics.ToReadOnlyAndFree();
        }
开发者ID:jkotas,项目名称:roslyn,代码行数:34,代码来源:LocalFunctionSymbol.cs

示例3: InvokeMember

        public static object InvokeMember(
            string file,
            string type,
            string member,
            BindingFlags invokeAttr,
            Binder binder,
            params object[] args
            )
        {
            object result = null;

            try
            {
                AppDomain domain = null;
                try
                {
                    domain = AppDomain.CreateDomain(DomainName);
                    DynamicInvokeMember loader = (DynamicInvokeMember)domain.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName, typeof(DynamicInvokeMember).FullName);
                    result = loader.InvokeMemberInternal(file, type, member, invokeAttr, binder, args);
                }
                catch { throw; }
                finally
                {
                    if (domain != null)
                    {
                        AppDomain.Unload(domain);
                    }
                }
            }
            catch { throw; }

            return result;
        }
开发者ID:tweeger,项目名称:DotNetSpy,代码行数:33,代码来源:DynamicInvokeMember.cs

示例4: GetValue

 public override Object GetValue(Object obj,BindingFlags invokeAttr,Binder binder,Object[] index,CultureInfo culture)
 {
     MethodInfo m = InternalGetter(true, false);
     if (m == null)
         throw new ArgumentException(System.Environment.GetResourceString("Arg_GetMethNotFnd"));
     return m.Invoke(obj,invokeAttr,binder,index,culture);   
 }
开发者ID:ArildF,项目名称:masters,代码行数:7,代码来源:runtimepropertyinfo.cs

示例5: Invoke

 public override object Invoke(BindingFlags invokeAttr, Binder binder, object[] parameters, System.Globalization.CultureInfo culture)
 {
     Type[] args = new Type[parameters.Length];
     for (var i = 0; i < args.Length; i++)
         args[i] = parameters[i] as Type;
     return TypeProxy.GetConstructor(target.MakeGenericType(args));
 }
开发者ID:modulexcite,项目名称:NiL.JS,代码行数:7,代码来源:GenericType.cs

示例6: CheckArguments

 internal object[] CheckArguments(object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)
 {
     int num = (parameters != null) ? parameters.Length : 0;
     object[] objArray = new object[num];
     ParameterInfo[] parametersNoCopy = null;
     for (int i = 0; i < num; i++)
     {
         object defaultValue = parameters[i];
         RuntimeType type = sig.Arguments[i];
         if (defaultValue == Type.Missing)
         {
             if (parametersNoCopy == null)
             {
                 parametersNoCopy = this.GetParametersNoCopy();
             }
             if (parametersNoCopy[i].DefaultValue == DBNull.Value)
             {
                 throw new ArgumentException(Environment.GetResourceString("Arg_VarMissNull"), "parameters");
             }
             defaultValue = parametersNoCopy[i].DefaultValue;
         }
         objArray[i] = type.CheckValue(defaultValue, binder, culture, invokeAttr);
     }
     return objArray;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:25,代码来源:MethodBase.cs

示例7: CreateInstance

        /// <include file='doc\Activator.uex' path='docs/doc[@for="Activator.CreateInstance1"]/*' />
        static public Object CreateInstance(Type type,
                                            BindingFlags bindingAttr,
                                            Binder binder,
                                            Object[] args,
                                            CultureInfo culture,
                                            Object[] activationAttributes)
        {
            if (type == null)
                throw new ArgumentNullException("type");

            if (type is System.Reflection.Emit.TypeBuilder)
                throw new NotSupportedException(Environment.GetResourceString( "NotSupported_CreateInstanceWithTypeBuilder" ));

            // If they didn't specify a lookup, then we will provide the default lookup.
            if ((bindingAttr & (BindingFlags) LookupMask) == 0)
                bindingAttr |= Activator.ConstructorDefault;

            try {
                RuntimeType rt = (RuntimeType) type.UnderlyingSystemType;
                return rt.CreateInstanceImpl(bindingAttr,binder,args,culture,activationAttributes);
            }
            catch (InvalidCastException) {
                throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"),"type");
            }
        }
开发者ID:ArildF,项目名称:masters,代码行数:26,代码来源:activator.cs

示例8:

 PropertyInfo IReflect.GetProperty(string name, BindingFlags bindingAttr,
     Binder binder, Type returnType, Type[] types,
     ParameterModifier[] modifiers)
 {
     return this.GetType().GetProperty(name, bindingAttr, binder,
     returnType, types, modifiers);
 }
开发者ID:Remy-Burney-Powerfront,项目名称:aspnet-redis-providers,代码行数:7,代码来源:RedisASPSessionDispatch.cs

示例9: GetValue

 public override object GetValue(object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
 {
     if (this.OnGetValue != null)
     {
         return this.OnGetValue(this, obj);
     }
     return null;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:ExtendedPropertyInfo.cs

示例10: GetPropertyImpl

        protected override PropertyInfo GetPropertyImpl(string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
        {
            PropertyInfo info = base.GetPropertyImpl(name, bindingAttr, binder, returnType, types, modifiers);

            if (name == "ItemTemplate")
                info = new FakePropertyInfo(info, this.listViewItemType);

            return info;
        }
开发者ID:dpawatts,项目名称:zeus,代码行数:9,代码来源:TypedListViewFakeType.cs

示例11: InvokeMember

		internal object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters)
		{
			Type type = base.GetType();
			if (!type.IsCOMObject)
			{
				throw new InvalidOperationException(Environment.GetResourceString("Arg_InvokeMember"));
			}
			return type.InvokeMember(name, invokeAttr, binder, this, args, modifiers, culture, namedParameters);
		}
开发者ID:ChristianWulf,项目名称:CSharpKDMDiscoverer,代码行数:9,代码来源:MarshalByRefObject.cs

示例12: GetValue

        public override object GetValue(object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
        {
            if (index !=null && index.Length > 0)
            {
                return Impromptu.InvokeGetIndex(obj, index);
            }

            return _cachedGet.Invoke(obj);
        }
开发者ID:bbenzikry,项目名称:impromptu-interface,代码行数:9,代码来源:ImpromptuRuntimeType.cs

示例13: Invoke

 public override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
 {
     if (parameters[0] == null)
     {
         return Activator.CreateInstance(base.resultType);
     }
     object operandValue = base.actualMethod.Invoke(null, invokeAttr, binder, parameters, culture);
     return Executor.AdjustType(base.actualMethod.ReturnType, operandValue, base.resultType);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:LiftedConversionMethodInfo.cs

示例14: Invoke

 public override object Invoke(
     object obj,
     BindingFlags invokeAttr,
     Binder binder,
     object[] parameters,
     CultureInfo culture)
 {
     throw new NotImplementedException();
 }
开发者ID:asmorger,项目名称:cash,代码行数:9,代码来源:MethodInfoWithNullDeclaringType.cs

示例15: GetMethodValidated

 internal static MethodInfo GetMethodValidated(this Type type, string name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers)
 {
     MethodInfo mi = type.GetMethod(name, bindingAttr, binder, types, modifiers);
     if (!mi.MatchesArgumentTypes(types))
     {
         return null;
     }
     return mi;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:TypeExtensions.cs


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