コード例 #1
0
 public override object GetParameterTypeByIndex(int idx)
 {
     if (idx >= 0)
     {
         ConstructorInfo info = this.ConstructInfo;
         if (info != null)
         {
             ParameterInfo[] ps = ConstructInfo.GetParameters();
             if (ps != null && idx < ps.Length)
             {
                 return(ps[idx]);
             }
         }
     }
     return(null);
 }
コード例 #2
0
        public override object GetParameterType(string name)
        {
            ConstructorInfo info = this.ConstructInfo;

            if (info != null)
            {
                ParameterInfo[] ps = ConstructInfo.GetParameters();
                if (ps != null)
                {
                    for (int i = 0; i < ps.Length; i++)
                    {
                        if (string.Compare(ps[i].Name, name, StringComparison.Ordinal) == 0)
                        {
                            return(ps[i].ParameterType);
                        }
                    }
                }
            }
            return(null);
        }
コード例 #3
0
        public override object GetParameterType(UInt32 id)
        {
            ConstructorInfo info = this.ConstructInfo;

            if (info != null)
            {
                ParameterInfo[] ps  = ConstructInfo.GetParameters();
                int             idi = (int)id;
                if (ps != null)
                {
                    if (ps.Length == 1)
                    {
                        return(ps[0].ParameterType);
                    }
                    for (int i = 0; i < ps.Length; i++)
                    {
                        if (string.IsNullOrEmpty(ps[i].Name))
                        {
                            if (ps[i].ParameterType.GetHashCode() == idi)
                            {
                                return(ps[i].ParameterType);
                            }
                            else if (ps[i].GetHashCode() == idi)
                            {
                                return(ps[i].ParameterType);
                            }
                            else if (ps[i].MetadataToken == idi)
                            {
                                return(ps[i].ParameterType);
                            }
                        }
                        else if (ps[i].Name.GetHashCode() == idi)
                        {
                            return(ps[i].ParameterType);
                        }
                    }
                }
            }
            return(null);
        }