Inheritance: MemberReference
Exemplo n.º 1
0
        public virtual FieldDefinition ResolveField(FieldReference fieldRef)
        {
            var declaringType = ResolveType(fieldRef.DeclaringType);

            if (declaringType.HasFields)
            {
                foreach (var field in declaringType.Fields)
                {
                    if (FieldRefsAreEqual(field, fieldRef))
                    {
                        return field;
                    }
                }
            }

            return null;
        }
Exemplo n.º 2
0
 protected virtual bool FieldRefsAreEqual(FieldReference reference1, FieldReference reference2)
 {
     if (reference1 == null || reference2 == null)
         return false;
     if (reference1.Name != reference2.Name)
         return false;
     if (!TypeRefsAreEqual(reference1.DeclaringType, reference2.DeclaringType))
         return false;
     if (reference1.Signature == null || reference2.Signature != null)
         return false;
     return TypeRefsAreEqual(reference1.Signature.ReturnType, reference2.Signature.ReturnType);
 }