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)); }
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); }
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); }
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; }
/// <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"); } }
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; }
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); }
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(); }
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; }
// CreateInstance // The following methods will create a new instance of an Object // Full Binding Support // For all of these methods we need to get the underlying RuntimeType and // call the Impl version. /// <include file='doc\Activator.uex' path='docs/doc[@for="Activator.CreateInstance"]/*' /> static public Object CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) { return CreateInstance(type, bindingAttr, binder, args, culture, null); }
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); }
public override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture) { if (index != null && index.Length > 0) { Impromptu.InvokeGetIndex(obj, index.Concat(new[] {value}).ToArray() ); return; } _cachedSet.Invoke(obj, value); }
protected override ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) { ConstructorInfo[] methods = GetConstructors (bindingAttr); return GetConstructorImpl (methods, bindingAttr, binder, callConvention, types, modifiers); }
public override object Invoke( object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) { throw new NotImplementedException(); }
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; }
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; }
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); }
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); }
// Invoke a specific type member. public override Object InvokeMember (String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) { return builder.InvokeMember(name, invokeAttr, binder, target, args, modifiers, culture, namedParameters); }
public sealed override object Invoke(BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) { binder.EnsureNotCustomBinder(); if (parameters == null) parameters = Array.Empty<Object>(); Object ctorAllocatedObject = this.MethodInvoker.Invoke(null, parameters); return ctorAllocatedObject; }
public override object GetValue(object obj, BindingFlags invokeAttr, Binder binder, object[] index, System.Globalization.CultureInfo culture) { IRuntimeContextInstance inst = obj as IRuntimeContextInstance; if (inst == null) throw new ArgumentException("Wrong argument type"); IValue retVal = inst.GetPropValue(_dispId); return COMWrapperContext.MarshalIValue(retVal); }
/// <summary> /// See <see cref="PropertyInfo.SetValue(object, object, BindingFlags, Binder, object[], CultureInfo)"/>. /// </summary> public override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture) { if (CanWrite) { setValueImpl(obj, value); } else { throw new NotSupportedException(); } }
/// <summary> /// See <see cref="PropertyInfo.GetValue(object, BindingFlags, Binder, object[], CultureInfo)"/>. /// </summary> public override object GetValue(object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture) { if (CanRead) { return getValueImpl(obj); } else { throw new NotSupportedException(); } }
public sealed override object Invoke(BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) { if (invokeAttr != BindingFlags.Default || binder != null || culture != null) throw new NotImplementedException(); if (parameters == null) parameters = Array.Empty<Object>(); Object ctorAllocatedObject = this.MethodInvoker.Invoke(null, parameters); return ctorAllocatedObject; }
public override object Invoke(Type[] types, object[] parameters, out Type returnType, Binder binder) { MethodInfo methodInfo = GetMethodInfo(types, binder); if (methodInfo == null) throw new MissingMethodException(MethodName); returnType = methodInfo.ReturnType; return methodInfo.Invoke(null, parameters); }
public override object Invoke(Type[] types, object[] parameters, out Type returnType, Binder binder) { MethodInfo methodInfo = GetMethodInfo(types, binder); if (methodInfo == null) throw new MissingMethodException(MethodName); returnType = methodInfo.ReturnType; return methodInfo.Invoke(_object, BindingFlags.Default, binder ?? LazyBinder.Default, parameters, null); }
// Returns the matching method if the parameter types are reference // assignable from the provided type arguments, otherwise null. internal static MethodInfo GetMethodValidated( this Type type, string name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers) { var method = type.GetMethod(name, bindingAttr, binder, types, modifiers); return method.MatchesArgumentTypes(types) ? method : null; }
public override object GetValue(object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture) { if ((this.getMethod == null) && ((this.originalPropertyInfo == null) || !this.originalPropertyInfo.CanRead)) { throw new InvalidOperationException(SR.GetString("Error_PropertyHasNoGetterDefined", new object[] { this.propertyName })); } if (this.getMethod != null) { return this.getMethod.Invoke(obj, invokeAttr, binder, index, culture); } return this.originalPropertyInfo.GetValue(obj, invokeAttr, binder, index, culture); }
// for remote COM Objects the late binding methods can't be // executed on proxies, so we need this method to execute on // the real object internal Object InvokeMember(String name,BindingFlags invokeAttr,Binder binder, Object[] args,ParameterModifier[] modifiers,CultureInfo culture,String[] namedParameters) { Type t = GetType(); // Sanity check if(!t.IsCOMObject) throw new InvalidOperationException(Environment.GetResourceString("Arg_InvokeMember")); // Call into the runtime to invoke on the COM object. return t.InvokeMember(name, invokeAttr, binder, this, args, modifiers, culture, namedParameters); }
internal void InternalSetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture, bool requiresAccessCheck, bool isBinderDefault) { RtFieldInfo field = this.m_field as RtFieldInfo; if (field != null) { field.InternalSetValue(obj, value, invokeAttr, binder, culture, false); } else { this.m_field.SetValue(obj, value, invokeAttr, binder, culture); } }
private static ObjectHandle CreateInstanceFrom(string assemblyFile, string typeName, bool ignoreCase, Reflection.BindingFlags bindingAttr, Reflection.Binder binder, object[] args, Globalization.CultureInfo culture, object[] activationAttributes) { return(CreateInstanceFromInternal(assemblyFile, typeName, ignoreCase, bindingAttr, binder, args, culture, activationAttributes, null)); }
private static ObjectHandle CreateInstanceFromInternal(String assemblyFile, String typeName, bool ignoreCase, Reflection.BindingFlags bindingAttr, Reflection.Binder binder, Object[] args, Globalization.CultureInfo culture, Object[] activationAttributes, Security.Policy.Evidence securityInfo) { #if FEATURE_CAS_POLICY Contract.Assert(AppDomain.CurrentDomain.IsLegacyCasPolicyEnabled || securityInfo == null); #endif // FEATURE_CAS_POLICY #pragma warning disable 618 Reflection.Assembly assembly = Reflection.Assembly.LoadFrom(assemblyFile); //, securityInfo); #pragma warning restore 618 Type t = assembly.GetType(typeName, true, ignoreCase); Object o = Activator.CreateInstance(t, bindingAttr, binder, args, culture, activationAttributes); // Log(o != null, "CreateInstanceFrom:: ", "Created Instance of class " + typeName, "Failed to create instance of class " + typeName); if (o == null) { return(null); } else { ObjectHandle Handle = new ObjectHandle(o); return(Handle); } }
public MethodInfo GetMethod(string name, BindingFlags bindAttr, System.Reflection.Binder binder, Type [] types, ParameterModifier [] modifiers) { throw new NotImplementedException(); }
System.Reflection.PropertyInfo IReflect.GetProperty(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, Type returnType, Type[] types, System.Reflection.ParameterModifier[] modifiers) { return(typeIReflectImplementation.GetProperty(name, bindingAttr, binder, returnType, types, modifiers)); }
protected override PropertyInfo GetPropertyImpl(string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) { if (returnType == null && types == null) { return(typeImpl.GetProperty(name, bindingAttr)); } else { return(typeImpl.GetProperty(name, bindingAttr, binder, returnType, types, modifiers)); } }
// InvokeMember: // If we get a call for DISPID=0, fire the CLR event. // object IReflect.InvokeMember(string name, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object target, object[] args, System.Reflection.ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, string[] namedParameters) { // if (name == "[DISPID=0]") { // we know we're getting called back to fire the event - translate this now into a CLR event. OnHtmlEvent(); // since there's no return value for void, return null. return(null); } else { return(typeIReflectImplementation.InvokeMember(name, invokeAttr, binder, target, args, modifiers, culture, namedParameters)); } }
protected override MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) { // This is interesting there are two paths into the impl. One that validates // type as non-null and one where type may be null. if (types == null) { return(typeImpl.GetMethod(name, bindingAttr)); } else { return(typeImpl.GetMethod(name, bindingAttr, binder, callConvention, types, modifiers)); } }
protected override System.Reflection.ConstructorInfo GetConstructorImpl(System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Reflection.CallingConventions callConvention, Type[] types, System.Reflection.ParameterModifier[] modifiers) { throw new NotImplementedException(); }
protected override ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) { throw new NotImplementedException(); }
public override void SetValue(Object obj, Object value, BindingFlags invokeAttr, System.Reflection.Binder binder, CultureInfo locale) { throw new NotImplementedException(); }
public override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture) { MethodInfo method = GetSetMethod(true); if (method == null) { throw new ArgumentException("Set Method not found for '" + Name + "'"); } object [] parms; if (index == null || index.Length == 0) { parms = new object [] { value } } ; else { int ilen = index.Length; parms = new object [ilen + 1]; index.CopyTo(parms, 0); parms [ilen] = value; } method.Invoke(obj, invokeAttr, binder, parms, culture); }
public override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) { throw new NotSupportedException(); }
public override object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) { throw new NotSupportedException(); }
public override void SetValue(object obj, object value, BindingFlags invokeAttr, System.Reflection.Binder binder, CultureInfo culture) { SetValue(obj, value); }
public override object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) { return(typeImpl.InvokeMember(name, invokeAttr, binder, target, args, modifiers, culture, namedParameters)); }
public ObjectHandle ActivatorCreateInstance(string assemblyName, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, object[] args, System.Globalization.CultureInfo culture, object[] activationAttributes) { return(Activator.CreateInstance(assemblyName, typeName, ignoreCase, bindingAttr, binder, args, culture, activationAttributes)); }
protected override ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) { return(typeImpl.GetConstructor(bindingAttr, binder, callConvention, types, modifiers)); }
public override object Invoke(object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, object[] parameters, CultureInfo culture) { throw new NotImplementedException(); }
public abstract object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture);
public object CreateInstanceAndUnwrap(string assemblyName, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, Object[] args, System.Globalization.CultureInfo culture, Object[] activationAttributes, System.Security.Policy.Evidence securityAttributes) { Contract.Ensures(Contract.Result <object>() != null); return(default(object)); }
public PropertyInfo GetProperty(string name, BindingFlags bindAttr, System.Reflection.Binder binder, Type returnType, Type [] types, ParameterModifier [] modifiers) { throw new NotImplementedException(); }
protected override MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, System.Reflection.Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) { return(typeof(object).GetMethod(name, bindingAttr, binder, callConvention, types, modifiers)); }
public System.Runtime.Remoting.ObjectHandle CreateInstance(string assemblyName, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, Object[] args, System.Globalization.CultureInfo culture, Object[] activationAttributes, System.Security.Policy.Evidence securityAttributes) { Contract.Requires(this != null); Contract.Requires(assemblyName != null); return(default(System.Runtime.Remoting.ObjectHandle)); }
// This method is called when in the source file we have something like: // - N.T.StaticProp // (most likely also when we have an instance prop...) // name -> "StaticProp" protected override System.Reflection.PropertyInfo GetPropertyImpl(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, Type returnType, Type[] types, System.Reflection.ParameterModifier[] modifiers) { // According to the spec, we should only expect these 4, so we guard against that here! Debug.Assert(bindingAttr == (BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly), "bindingAttr has value not according to the spec!"); Debug.Assert(binder == null && returnType == null && types == null && modifiers == null, "One of binder, returnType, types, or modifiers was not null"); if (name == _Property1.Name) { return(_Property1); } else { return(null); } }
protected override System.Reflection.MethodInfo GetMethodImpl(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Reflection.CallingConventions callConvention, Type[] types, System.Reflection.ParameterModifier[] modifiers) { Debug.Assert(false, "NYI"); throw new NotImplementedException(); }
public override object InvokeMember(string name, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object target, object[] args, System.Reflection.ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, string[] namedParameters) { Debug.Assert(false, "NYI"); throw new NotImplementedException(); }
// Set the value associated with this property on an object. public abstract void SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture);
System.Reflection.MethodInfo IReflect.GetMethod(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, Type[] types, System.Reflection.ParameterModifier[] modifiers) { return(typeIReflectImplementation.GetMethod(name, bindingAttr, binder, types, modifiers)); }
protected override System.Reflection.PropertyInfo GetPropertyImpl(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, Type returnType, Type[] types, System.Reflection.ParameterModifier[] modifiers) { throw new NotImplementedException(); }
protected override MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) { throw new NotImplementedException(); }