Пример #1
0
        public static bool IsPropertyVirtual(IPropertyDefinition prop)
        {
            if (Util.ContainingTypeDefinition(prop).IsInterface)
                return true;

            IMethodReference getter = prop.Getter;
            if (getter != null)
                return ResolveMethodThrowing(getter).IsVirtual;
            IMethodReference setter = prop.Setter;
            if (setter != null)
                return ResolveMethodThrowing(setter).IsVirtual;

            throw new Exception(String.Format("Property {0} has no accessors. Cannot determine whether it is virtual or not", prop.ToString()));
        }
Пример #2
0
 public static PropertyDefinition FindMatchingProperty(TypeDefinition tdef, IPropertyDefinition item)
 {
     return(tdef.Properties.FirstOrDefault(p => p.ToString() == item.ToString()));
 }
Пример #3
0
        public static bool IsPropertyVirtual(IPropertyDefinition prop)
        {
            if (Util.ContainingTypeDefinition(prop).IsInterface)
            {
                return(true);
            }

            IMethodReference getter = prop.Getter;

            if (getter != null)
            {
                return(ResolveMethodThrowing(getter).IsVirtual);
            }
            IMethodReference setter = prop.Setter;

            if (setter != null)
            {
                return(ResolveMethodThrowing(setter).IsVirtual);
            }

            throw new Exception(String.Format("Property {0} has no accessors. Cannot determine whether it is virtual or not", prop.ToString()));
        }