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

◆ ValidateGenericArguments()

static void System.RuntimeType.ValidateGenericArguments ( MemberInfo definition,
RuntimeType[] genericArguments,
Exception e )
inlinestaticpackage

Definition at line 1800 of file RuntimeType.cs.

1801 {
1802 RuntimeType[] typeContext = null;
1803 RuntimeType[] methodContext = null;
1805 if (definition is Type)
1806 {
1808 genericArgumentsInternal = runtimeType.GetGenericArgumentsInternal();
1810 }
1811 else
1812 {
1814 genericArgumentsInternal = runtimeMethodInfo.GetGenericArgumentsInternal();
1817 if (runtimeType2 != null)
1818 {
1819 typeContext = runtimeType2.GetTypeHandleInternal().GetInstantiationInternal();
1820 }
1821 }
1822 for (int i = 0; i < genericArguments.Length; i++)
1823 {
1826 if (!RuntimeTypeHandle.SatisfiesConstraints(type2.GetTypeHandleInternal().GetTypeChecked(), typeContext, methodContext, type.GetTypeHandleInternal().GetTypeChecked()))
1827 {
1828 throw new ArgumentException(SR.Format(SR.Argument_GenConstraintViolation, i.ToString(), type, definition, type2), e);
1829 }
1830 }
1831 }

References System.RuntimeType.RuntimeType(), System.SR.Argument_GenConstraintViolation, System.SR.Format(), System.RuntimeTypeHandle.SatisfiesConstraints(), and System.type.

Referenced by System.Reflection.RuntimeMethodInfo.MakeGenericMethod(), and System.RuntimeType.MakeGenericType().