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


C# ParameterInfo.GetUpperBound方法代码示例

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


在下文中一共展示了ParameterInfo.GetUpperBound方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MatchesParamArraySignature

 private bool MatchesParamArraySignature(ParameterInfo[] param0, ParameterInfo[] param1, int ParamArrayIndex1, bool IsPropertySet, int ArgCountUpperBound)
 {
     int upperBound = param0.GetUpperBound(0);
     if (IsPropertySet)
     {
         upperBound--;
     }
     upperBound = Math.Min(upperBound, ArgCountUpperBound);
     int num3 = upperBound;
     for (int i = 0; i <= num3; i++)
     {
         Type elementType;
         Type parameterType = param0[i].ParameterType;
         if (parameterType.IsByRef)
         {
             parameterType = parameterType.GetElementType();
         }
         if (i >= ParamArrayIndex1)
         {
             elementType = param1[ParamArrayIndex1].ParameterType.GetElementType();
         }
         else
         {
             elementType = param1[i].ParameterType;
             if (elementType.IsByRef)
             {
                 elementType = elementType.GetElementType();
             }
         }
         if (parameterType != elementType)
         {
             return false;
         }
     }
     return true;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:36,代码来源:VBBinder.cs

示例2: BindingScore

 private BindScore BindingScore(ParameterInfo[] Parameters, int[] paramOrder, Type[] ArgTypes, bool IsPropertySet, int ParamArrayIndex)
 {
     BindScore exact = BindScore.Exact;
     int upperBound = ArgTypes.GetUpperBound(0);
     int num3 = Parameters.GetUpperBound(0);
     if (IsPropertySet)
     {
         num3--;
         upperBound--;
     }
     int num5 = Math.Max(upperBound, num3);
     for (int i = 0; i <= num5; i++)
     {
         int num;
         Type type;
         if (paramOrder == null)
         {
             num = i;
         }
         else
         {
             num = paramOrder[i];
         }
         if (num == -1)
         {
             type = null;
         }
         else
         {
             type = ArgTypes[num];
         }
         if (type != null)
         {
             Type parameterType;
             if (i > num3)
             {
                 parameterType = Parameters[ParamArrayIndex].ParameterType;
             }
             else
             {
                 parameterType = Parameters[i].ParameterType;
             }
             if (((i != ParamArrayIndex) || !type.IsArray) || (parameterType != type))
             {
                 if (((i == ParamArrayIndex) && type.IsArray) && (((this.m_state.m_OriginalArgs == null) || (this.m_state.m_OriginalArgs[num] == null)) || parameterType.IsInstanceOfType(this.m_state.m_OriginalArgs[num])))
                 {
                     if (exact < BindScore.Widening1)
                     {
                         exact = BindScore.Widening1;
                     }
                 }
                 else
                 {
                     if (((ParamArrayIndex != -1) && (i >= ParamArrayIndex)) || parameterType.IsByRef)
                     {
                         parameterType = parameterType.GetElementType();
                     }
                     if (type != parameterType)
                     {
                         if (ObjectType.IsWideningConversion(type, parameterType))
                         {
                             if (exact < BindScore.Widening1)
                             {
                                 exact = BindScore.Widening1;
                             }
                         }
                         else if (type.IsArray && (((this.m_state.m_OriginalArgs == null) || (this.m_state.m_OriginalArgs[num] == null)) || parameterType.IsInstanceOfType(this.m_state.m_OriginalArgs[num])))
                         {
                             if (exact < BindScore.Widening1)
                             {
                                 exact = BindScore.Widening1;
                             }
                         }
                         else
                         {
                             exact = BindScore.Narrowing;
                         }
                     }
                 }
             }
         }
     }
     return exact;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:84,代码来源:VBBinder.cs

示例3: CreateParamOrder

 private Exception CreateParamOrder(bool SetProp, int[] paramOrder, ParameterInfo[] pars, object[] args, string[] names)
 {
     int num;
     bool[] flagArray = new bool[(pars.Length - 1) + 1];
     int num4 = (args.Length - names.Length) - 1;
     int upperBound = pars.GetUpperBound(0);
     int num5 = pars.GetUpperBound(0);
     for (num = 0; num <= num5; num++)
     {
         paramOrder[num] = -1;
     }
     if (SetProp)
     {
         paramOrder[pars.GetUpperBound(0)] = args.GetUpperBound(0);
         num4--;
         upperBound--;
     }
     int num6 = num4;
     for (num = 0; num <= num6; num++)
     {
         paramOrder[num] = names.Length + num;
     }
     int num7 = names.GetUpperBound(0);
     for (num = 0; num <= num7; num++)
     {
         int num8 = upperBound;
         int index = 0;
         while (index <= num8)
         {
             if (Strings.StrComp(names[num], pars[index].Name, CompareMethod.Text) == 0)
             {
                 if (paramOrder[index] != -1)
                 {
                     return new ArgumentException(Utils.GetResourceString("NamedArgumentAlreadyUsed1", new string[] { pars[index].Name }));
                 }
                 paramOrder[index] = num;
                 flagArray[num] = true;
                 break;
             }
             index++;
         }
         if (index > upperBound)
         {
             return new MissingMemberException(Utils.GetResourceString("Argument_InvalidNamedArg2", new string[] { names[num], this.CalledMethodName() }));
         }
     }
     return null;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:48,代码来源:VBBinder.cs


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