505 {
506 if (indexes != null)
507 {
509 {
511 {
512 throw new ArgumentNullException("indexes");
513 }
514 }
515 }
517 {
519 }
521 int j = 0;
522 int num = 0;
523 int num2 = ((indexes != null) ? indexes.Length : 0);
524 for (
int k = 0; k <
array.Length; k++)
525 {
526 if (indexes != null)
527 {
529 if (indexParameters.Length != num2)
530 {
531 continue;
532 }
533 for (j = 0; j < num2; j++)
534 {
536 if (parameterType == indexes[j] || parameterType == typeof(object))
537 {
538 continue;
539 }
540 if (parameterType.IsPrimitive)
541 {
542 if (!indexes[j].UnderlyingSystemType.IsRuntimeImplemented() || !
CanChangePrimitive(indexes[j].UnderlyingSystemType, parameterType.UnderlyingSystemType))
543 {
544 break;
545 }
546 }
547 else if (!parameterType.IsAssignableFrom(indexes[j]))
548 {
549 break;
550 }
551 }
552 }
553 if (j != num2)
554 {
555 continue;
556 }
557 if (returnType != null)
558 {
559 if (
array[k].PropertyType.IsPrimitive)
560 {
561 if (!returnType.UnderlyingSystemType.IsRuntimeImplemented() || !
CanChangePrimitive(returnType.UnderlyingSystemType,
array[k].PropertyType.UnderlyingSystemType))
562 {
563 continue;
564 }
565 }
566 else if (!
array[k].PropertyType.IsAssignableFrom(returnType))
567 {
568 continue;
569 }
570 }
572 }
573 switch (num)
574 {
575 case 0:
576 return null;
577 case 1:
579 default:
580 {
581 int num3 = 0;
582 bool flag = false;
583 int[] array2 = new int[num2];
584 for (int k = 0; k < num2; k++)
585 {
586 array2[k] = k;
587 }
588 for (int k = 1; k < num; k++)
589 {
591 if (num4 == 0 && indexes != null)
592 {
593 num4 =
FindMostSpecific(
array[num3].GetIndexParameters(), array2,
null,
array[k].GetIndexParameters(), array2,
null, indexes,
null);
594 }
595 if (num4 == 0)
596 {
598 if (num4 == 0)
599 {
600 flag = true;
601 }
602 }
603 if (num4 == 2)
604 {
605 flag = false;
606 num3 = k;
607 }
608 }
609 if (flag)
610 {
612 }
614 }
615 }
616 }
static bool CanChangePrimitive(Type source, Type target)
static int FindMostSpecificProperty(PropertyInfo cur1, PropertyInfo cur2)
static int FindMostSpecific(ParameterInfo[] p1, int[] paramOrder1, Type paramArrayType1, ParameterInfo[] p2, int[] paramOrder2, Type paramArrayType2, Type[] types, object[] args)
static int FindMostSpecificType(Type c1, Type c2, Type t)
virtual Type ParameterType