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

◆ GetField() [2/2]

override FieldInfo System.RuntimeType.GetField ( string name,
BindingFlags bindingAttr )
inline

Implements System.Reflection.IReflect.

Definition at line 2511 of file RuntimeType.cs.

2512 {
2513 if (name == null)
2514 {
2515 throw new ArgumentNullException();
2516 }
2518 RuntimeFieldInfo[] fieldList = Cache.GetFieldList(listType, name);
2519 FieldInfo fieldInfo = null;
2520 bindingAttr ^= BindingFlags.DeclaredOnly;
2521 bool flag = false;
2523 {
2524 if ((bindingAttr & runtimeFieldInfo.BindingFlags) != runtimeFieldInfo.BindingFlags)
2525 {
2526 continue;
2527 }
2528 if (fieldInfo != null)
2529 {
2530 if ((object)runtimeFieldInfo.DeclaringType == fieldInfo.DeclaringType)
2531 {
2532 throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException);
2533 }
2534 if (fieldInfo.DeclaringType.IsInterface && runtimeFieldInfo.DeclaringType.IsInterface)
2535 {
2536 flag = true;
2537 }
2538 }
2539 if (fieldInfo == null || runtimeFieldInfo.DeclaringType.IsSubclassOf(fieldInfo.DeclaringType) || fieldInfo.DeclaringType.IsInterface)
2540 {
2542 }
2543 }
2544 if (flag && fieldInfo.DeclaringType.IsInterface)
2545 {
2546 throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException);
2547 }
2548 return fieldInfo;
2549 }
static void FilterHelper(BindingFlags bindingFlags, ref string name, bool allowPrefixLookup, out bool prefixLookup, out bool ignoreCase, out MemberListType listType)

References System.SR.Arg_AmbiguousMatchException, and System.RuntimeType.FilterHelper().

Referenced by System.Reflection.Emit.TypeBuilder.GetField(), and System.Reflection.RuntimeModule.GetField().