Esempio n. 1
0
 public ParameterInfo[] GetDynamicMethodParameters(string methodName, object attrs)
 {
     if (string.CompareOrdinal(methodName, "FormTextValue") == 0)
     {
         if (_fields != null)
         {
             List <ParameterInfo> pl = new List <ParameterInfo>();
             foreach (KeyValuePair <string, string> kv in _fields)
             {
                 SimpleParameterInfo spi = new SimpleParameterInfo(kv.Key, methodName, typeof(string), kv.Key);
                 pl.Add(spi);
             }
             return(pl.ToArray());
         }
     }
     return(new ParameterInfo[] { });
 }
 public ParameterInfo[] GetDynamicMethodParameters(string methodName, object av)
 {
     if (string.CompareOrdinal(methodName, "FormatStringWithValues") == 0)
     {
         if (_fields != null && _fields.Count > 0)
         {
             ParameterInfo[] ps = new ParameterInfo[_fields.Count];
             for (int i = 0; i < _fields.Count; i++)
             {
                 ps[i] = new SimpleParameterInfo(_fields[i], methodName, typeof(object), string.Format(System.Globalization.CultureInfo.InvariantCulture, "field {0}", _fields[i]));
             }
             return(ps);
         }
         return(new ParameterInfo[] { });
     }
     return(null);
 }
 public ParameterInfo[] GetDynamicMethodParameters(string methodName, object attrs)
 {
     if (string.CompareOrdinal(methodName, "StartWithParameterValues") == 0)
     {
         FieldList pl = Parameters;
         if (pl != null && pl.Count > 0)
         {
             ParameterInfo[] ps = new ParameterInfo[pl.Count];
             for (int i = 0; i < pl.Count; i++)
             {
                 EPField f = pl[i];
                 ps[i] = new SimpleParameterInfo(f.Name, methodName, EPField.ToSystemType(f.OleDbType), string.Format(System.Globalization.CultureInfo.InvariantCulture, "parameter {0}", f.Name));
             }
             return(ps);
         }
         return(new ParameterInfo[] { });
     }
     return(null);
 }
Esempio n. 4
0
        private MethodRef MakeMethodRef(Cci.IMethodReference methodRef, Cci.ISpecializedMethodReference specializedRef, bool isConstructor)
        {
            Type declaringType = ResolveType(methodRef.GetContainingType(_context));

            MethodBase unspecializedDefinition = null;
            if (specializedRef != null)
            {
                // resolvemethod
                unspecializedDefinition = isConstructor ? ResolveConstructor(specializedRef.UnspecializedVersion) : ResolveMethod(specializedRef.UnspecializedVersion);
            }

            var m = new MethodRef(declaringType, methodRef.Name, GetManagedCallingConvention(methodRef.CallingConvention), unspecializedDefinition, GetExtraParameterTypes(methodRef));

            Type[] genericParameters;
            ParameterInfo[] parameters;
            ParameterInfo returnParameter;

            if (unspecializedDefinition != null)
            {
                if (isConstructor)
                {
                    returnParameter = new SimpleParameterInfo(unspecializedDefinition, 0, typeof(void));
                }
                else
                {
                    returnParameter = ((MethodInfo)unspecializedDefinition).ReturnParameter;
                }

                // TODO(tomat): change containing method?
                genericParameters = unspecializedDefinition.GetGenericArguments();
                parameters = unspecializedDefinition.GetParameters();
            }
            else
            {
                MakeMethodParameters(m, methodRef, out genericParameters, out parameters, out returnParameter);
            }

            m.InitializeParameters(genericParameters, parameters, returnParameter);

            return m;
        }