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

◆ GetMethodImpl()

virtual MethodInfo System.Delegate.GetMethodImpl ( )
inlineprotectedvirtual

Reimplemented in System.MulticastDelegate.

Definition at line 118 of file Delegate.cs.

119 {
120 if (_methodBase == null || !(_methodBase is MethodInfo))
121 {
122 IRuntimeMethodInfo runtimeMethodInfo = FindMethodHandle();
123 RuntimeType runtimeType = RuntimeMethodHandle.GetDeclaringType(runtimeMethodInfo);
124 if ((RuntimeTypeHandle.IsGenericTypeDefinition(runtimeType) || RuntimeTypeHandle.HasInstantiation(runtimeType)) && (RuntimeMethodHandle.GetAttributes(runtimeMethodInfo) & MethodAttributes.Static) == 0)
125 {
126 if (_methodPtrAux == IntPtr.Zero)
127 {
128 Type type = _target.GetType();
129 Type genericTypeDefinition = runtimeType.GetGenericTypeDefinition();
130 while (type != null)
131 {
132 if (type.IsGenericType && type.GetGenericTypeDefinition() == genericTypeDefinition)
133 {
134 runtimeType = type as RuntimeType;
135 break;
136 }
137 type = type.BaseType;
138 }
139 }
140 else
141 {
142 MethodInfo method = GetType().GetMethod("Invoke");
143 runtimeType = (RuntimeType)method.GetParameters()[0].ParameterType;
144 }
145 }
146 _methodBase = (MethodInfo)RuntimeType.GetMethodBase(runtimeType, runtimeMethodInfo);
147 }
148 return (MethodInfo)_methodBase;
149 }
object _target
Definition Delegate.cs:13
IRuntimeMethodInfo FindMethodHandle()
IntPtr _methodPtrAux
Definition Delegate.cs:19
object _methodBase
Definition Delegate.cs:15
ParameterInfo[] GetParameters()

References System.Delegate._methodBase, System.Delegate._methodPtrAux, System.Delegate._target, System.RuntimeType.BaseType, System.Runtime.Serialization.Dictionary, System.Delegate.FindMethodHandle(), System.RuntimeMethodHandle.GetAttributes(), System.RuntimeMethodHandle.GetDeclaringType(), System.Type.GetGenericTypeDefinition(), System.RuntimeType.GetMethodBase(), System.Reflection.MethodBase.GetParameters(), System.RuntimeTypeHandle.HasInstantiation(), System.RuntimeTypeHandle.IsGenericTypeDefinition(), System.Reflection.ParameterInfo.ParameterType, System.type, and System.IntPtr.Zero.