private void InitializeContentPropertyIfNecessary() { bool flag; if (!this.contentPropertyIsInitialized) { this.contentPropertyIsInitialized = true; string nameFromNearestNonEmptyContentPropertyAttribute = ClrObjectMetadata.GetNameFromNearestNonEmptyContentPropertyAttribute(this.typeResolver.PlatformMetadata, this.baseType, out flag); if (!string.IsNullOrEmpty(nameFromNearestNonEmptyContentPropertyAttribute)) { this.contentProperty = ClrObjectMetadata.GetContentProperty(this.typeResolver, this.baseType, nameFromNearestNonEmptyContentPropertyAttribute); if (this.contentProperty != null) { this.contentPropertyIsHidden = flag; return; } } else if (this.supportsInlineXml) { this.contentProperty = this.TypeResolver.ResolveProperty(this.typeResolver.PlatformMetadata.KnownProperties.DesignTimeInlineXml); } } }
private static string GetNameFromNearestNonEmptyContentPropertyAttribute(IPlatformMetadata platformMetadata, Type type, out bool anySkipped) { anySkipped = false; IType type1 = platformMetadata.ResolveType(PlatformTypes.ContentPropertyAttribute); ReferenceStep member = (ReferenceStep)type1.GetMember(MemberType.Property, "Name", MemberAccessTypes.Public); string valueFromAttribute = ClrObjectMetadata.GetValueFromAttribute(type1, member, type, true) as string; if (!string.IsNullOrEmpty(valueFromAttribute)) { return(valueFromAttribute); } while (type != null) { valueFromAttribute = ClrObjectMetadata.GetValueFromAttribute(type1, member, type, false) as string; if (!string.IsNullOrEmpty(valueFromAttribute)) { anySkipped = true; return(valueFromAttribute); } type = type.BaseType; } return(null); }