Пример #1
0
        public static bool IsBackingField(this FieldInfo info)
        {
            var propertyName = NamingUtils.GetAutoPropertyName(info.Name);

            if (string.IsNullOrEmpty(propertyName))
            {
                return(false);
            }
            return(info.HasAttribute <CompilerGeneratedAttribute>());
        }
Пример #2
0
        public static PropertyInfo GetEncapsulatingAutoProperty(this FieldInfo info)
        {
            var propertyName = NamingUtils.GetAutoPropertyName(info.Name);

            if (!string.IsNullOrEmpty(propertyName))
            {
                return(info.DeclaringType.Property(propertyName));
            }

            return(null);
        }