Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ FindMostSpecific()

static int System.DefaultBinder.FindMostSpecific ( ParameterInfo[] p1,
int[] paramOrder1,
Type paramArrayType1,
ParameterInfo[] p2,
int[] paramOrder2,
Type paramArrayType2,
Type[] types,
object[] args )
inlinestaticprivateinherited

Definition at line 725 of file DefaultBinder.cs.

726 {
727 if (paramArrayType1 != null && paramArrayType2 == null)
728 {
729 return 2;
730 }
731 if (paramArrayType2 != null && paramArrayType1 == null)
732 {
733 return 1;
734 }
735 bool flag = false;
736 bool flag2 = false;
737 for (int i = 0; i < types.Length; i++)
738 {
739 if (args != null && args[i] == Type.Missing)
740 {
741 continue;
742 }
743 Type type = ((!(paramArrayType1 != null) || paramOrder1[i] < p1.Length - 1) ? p1[paramOrder1[i]].ParameterType : paramArrayType1);
744 Type type2 = ((!(paramArrayType2 != null) || paramOrder2[i] < p2.Length - 1) ? p2[paramOrder2[i]].ParameterType : paramArrayType2);
745 if (!(type == type2))
746 {
747 switch (FindMostSpecificType(type, type2, types[i]))
748 {
749 case 0:
750 return 0;
751 case 1:
752 flag = true;
753 break;
754 case 2:
755 flag2 = true;
756 break;
757 }
758 }
759 }
760 if (flag == flag2)
761 {
762 if (!flag && args != null)
763 {
764 if (p1.Length > p2.Length)
765 {
766 return 1;
767 }
768 if (p2.Length > p1.Length)
769 {
770 return 2;
771 }
772 }
773 return 0;
774 }
775 if (!flag)
776 {
777 return 2;
778 }
779 return 1;
780 }
static int FindMostSpecificType(Type c1, Type c2, Type t)

References System.DefaultBinder.FindMostSpecificType(), System.Type.Missing, System.Reflection.ParameterInfo.ParameterType, and System.type.

Referenced by System.DefaultBinder.FindMostSpecificMethod(), and System.DefaultBinder.SelectProperty().