public static bool IsBackingField(this FieldInfo info) { var propertyName = NamingUtils.GetAutoPropertyName(info.Name); if (string.IsNullOrEmpty(propertyName)) { return(false); } return(info.HasAttribute <CompilerGeneratedAttribute>()); }
public static PropertyInfo GetEncapsulatingAutoProperty(this FieldInfo info) { var propertyName = NamingUtils.GetAutoPropertyName(info.Name); if (!string.IsNullOrEmpty(propertyName)) { return(info.DeclaringType.Property(propertyName)); } return(null); }