Esempio n. 1
0
        /// <summary>
        /// 设置输出参数匹配输入参数
        /// </summary>
        /// <param name="inputParameters"></param>
        private void setInputParameter(MethodParameterPair[] inputParameters)
        {
            int parameterIndex = 0;

            foreach (MethodParameterPair parameter in inputParameters)
            {
                if (parameter.MethodParameter.ParameterName == MethodParameter.ParameterName)
                {
                    InputMethodParameter = parameter.MethodParameter;
                    InputParameter       = parameter.Parameter;
                    inputParameters[parameterIndex].setInputParameter(MethodParameter, Parameter);
                    break;
                }
                ++parameterIndex;
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 成员方法
 /// </summary>
 /// <param name="field">字段信息</param>
 /// <param name="isGet">是否取值</param>
 internal MethodIndex(FieldInfo field, bool isGet)
     : base(field.FieldType, field.Name)
 {
     customMember = field;
     if (IsGetMember = isGet)
     {
         ReturnType = field.FieldType;
         Parameters = NullValue <MethodParameter> .Array;
     }
     else
     {
         ReturnType = typeof(void);
         Parameters = new MethodParameter[] { new MethodParameter("value", field.FieldType) };
     }
     OutputParameters  = NullValue <MethodParameter> .Array;
     GenericParameters = NullValue <ExtensionType> .Array;
 }
Esempio n. 3
0
 /// <summary>
 /// 获取函数参数匹配信息
 /// </summary>
 /// <param name="methodParameters"></param>
 /// <param name="types"></param>
 /// <returns></returns>
 public static          MethodParameterPair[] Get(MethodParameter[] methodParameters, MethodParameterTypeNames types)
 {
     MethodParameterPair[] parameters = get(methodParameters, types.Parameters);
     for (int index = 0, endIndex = methodParameters.Length - 1; index < endIndex; ++index)
     {
         MethodParameter methodParameter = methodParameters[index];
         for (int copyIndex = index; true; ++copyIndex)
         {
             MethodParameter copyParameter = parameters[copyIndex].Parameter;
             if (methodParameter.ParameterType == copyParameter.ParameterType && methodParameter.ParameterName == copyParameter.ParameterName)
             {
                 if (index != copyIndex)
                 {
                     parameters[copyIndex].Parameter = parameters[index].Parameter;
                     parameters[index].Parameter     = copyParameter;
                 }
                 break;
             }
         }
     }
     return(parameters);
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public bool Equals(MethodParameterTypeNames other)
 {
     if (((hashCode ^ other.hashCode) | (Parameters.Length ^ other.Parameters.Length)) == 0 && MethodReturnType == other.MethodReturnType &&
         IsSerializeReferenceMember == other.IsSerializeReferenceMember && IsSerializeBox == other.IsSerializeBox)
     {
         int index = 0;
         foreach (MethodParameter otherParameter in other.Parameters)
         {
             MethodParameter parameter = Parameters[index++];
             if (parameter.ParameterType != otherParameter.ParameterType)
             {
                 return(false);
             }
             if (parameter.ParameterName != otherParameter.ParameterName)
             {
                 return(false);
             }
         }
         return(true);
     }
     return(false);
 }
Esempio n. 5
0
 /// <summary>
 /// 设置输出参数匹配输入参数
 /// </summary>
 /// <param name="methodParameter"></param>
 /// <param name="parameter"></param>
 private void setInputParameter(MethodParameter methodParameter, MethodParameter parameter)
 {
     InputMethodParameter = methodParameter;
     InputParameter       = parameter;
 }
Esempio n. 6
0
 /// <summary>
 /// 设置函数参数匹配信息
 /// </summary>
 /// <param name="methodParameter"></param>
 /// <param name="parameter"></param>
 private void set(MethodParameter methodParameter, MethodParameter parameter)
 {
     MethodParameter = methodParameter;
     Parameter       = parameter;
 }
        /// <summary>
        /// 比较大小
        /// </summary>
        /// <param name="left"></param>
        /// <param name="right"></param>
        /// <returns></returns>
        private static int compare(MethodParameter left, MethodParameter right)
        {
            int value = string.CompareOrdinal(left.ParameterName, right.ParameterName);

            return(value == 0 ? string.CompareOrdinal(left.ParameterType.FullName, right.ParameterType.FullName) : value);
        }
Esempio n. 8
0
 /// <summary>
 /// 比较大小
 /// </summary>
 /// <param name="left"></param>
 /// <param name="right"></param>
 /// <returns></returns>
 private static int compare(MethodParameter left, MethodParameter right)
 {
     return(string.CompareOrdinal(left.ParameterType.FullName, right.ParameterType.FullName));
 }