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

◆ GetInterfaceMap()

override InterfaceMapping System.RuntimeType.GetInterfaceMap ( [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type ifaceType)
inlinevirtual

Reimplemented from System.Type.

Definition at line 2317 of file RuntimeType.cs.

2318 {
2320 {
2321 throw new InvalidOperationException(SR.Arg_GenericParameter);
2322 }
2323 if ((object)ifaceType == null)
2324 {
2325 throw new ArgumentNullException("ifaceType");
2326 }
2328 if (runtimeType == null)
2329 {
2330 throw new ArgumentException(SR.Argument_MustBeRuntimeType, "ifaceType");
2331 }
2332 RuntimeTypeHandle typeHandleInternal = runtimeType.GetTypeHandleInternal();
2333 GetTypeHandleInternal().VerifyInterfaceIsImplemented(typeHandleInternal);
2334 if (IsSZArray && ifaceType.IsGenericType)
2335 {
2336 throw new ArgumentException(SR.Argument_ArrayGetInterfaceMap);
2337 }
2338 int numVirtualsAndStaticVirtuals = RuntimeTypeHandle.GetNumVirtualsAndStaticVirtuals(runtimeType);
2340 result.InterfaceType = ifaceType;
2341 result.TargetType = this;
2342 result.InterfaceMethods = new MethodInfo[numVirtualsAndStaticVirtuals];
2343 result.TargetMethods = new MethodInfo[numVirtualsAndStaticVirtuals];
2344 for (int i = 0; i < numVirtualsAndStaticVirtuals; i++)
2345 {
2346 RuntimeMethodHandleInternal methodAt = RuntimeTypeHandle.GetMethodAt(runtimeType, i);
2348 result.InterfaceMethods[i] = (MethodInfo)methodBase;
2349 RuntimeMethodHandleInternal interfaceMethodImplementation = GetTypeHandleInternal().GetInterfaceMethodImplementation(typeHandleInternal, methodAt);
2350 if (!interfaceMethodImplementation.IsNullHandle())
2351 {
2352 RuntimeType runtimeType2 = RuntimeMethodHandle.GetDeclaringType(interfaceMethodImplementation);
2353 if (!runtimeType2.IsInterface)
2354 {
2355 runtimeType2 = this;
2356 }
2358 result.TargetMethods[i] = (MethodInfo)methodBase2;
2359 }
2360 }
2361 return result;
2362 }
override bool IsSZArray
override bool IsGenericParameter
static MethodBase GetMethodBase(RuntimeModule scope, int typeMetadataToken)
virtual RuntimeTypeHandle GetTypeHandleInternal()
Definition Type.cs:449

References System.RuntimeType.RuntimeType(), System.SR.Arg_GenericParameter, System.SR.Argument_ArrayGetInterfaceMap, System.SR.Argument_MustBeRuntimeType, System.RuntimeMethodHandle.GetDeclaringType(), System.RuntimeTypeHandle.GetMethodAt(), System.RuntimeType.GetMethodBase(), System.RuntimeTypeHandle.GetNumVirtualsAndStaticVirtuals(), System.Type.GetTypeHandleInternal(), System.RuntimeType.IsGenericParameter, and System.RuntimeType.IsSZArray.

Referenced by System.Reflection.Emit.TypeBuilder.GetInterfaceMap().