private static IEnumerable <string> AddTypeWildcardToNameOnlyProperties(PropertiesCollection properties) { var propertiesWithNameOnly = properties.Where(IsNameOnlyProperty); var propertiesWithWilcardAsType = propertiesWithNameOnly.Select(p => GetFullName(Wildcard, p)); return(properties.Except(propertiesWithNameOnly).Union(propertiesWithWilcardAsType)); }
private PropertiesCollection NormalizeProperties(PropertiesCollection properties) { if (this.PropertyMatchMode == PropertyMatchMode.Name) { return(new PropertiesCollection(AddTypeWildcardToNameOnlyProperties(properties))); } return(properties); }
/// <summary> /// Creates properties for the given <see cref="T:Newtonsoft.Json.Serialization.JsonContract" />. /// </summary> /// <param name="type">The type to create properties for.</param> /// <param name="memberSerialization">The member serialization mode for the type.</param> /// <returns> /// Properties for the given <see cref="T:Newtonsoft.Json.Serialization.JsonContract" />. /// </returns> protected override IList <JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization) { this.normalizedProperties = this.NormalizeProperties(this.Properties); this.normalizedExcludeProperties = this.NormalizeProperties(this.ExcludeProperties); if (this.NoPropertiesHaveBeenSpecified()) { this.MarkAllPropertiesForSerialization(); } return(base.CreateProperties(type, memberSerialization)); }