public bool ShouldWriteProperty(object propertyValue, PropertyConfigs config) { var isDefaultValue = propertyValue == null || Equals(DefaultValue, propertyValue); if (isDefaultValue) { if (!isEnum) { if (propertySuppressDefaultAttribute || config.ExcludeDefaultValues) { return(false); } if (!Serializer.IncludeNullValues && (propertyValue == null || propertySuppressDefaultConfig)) { return(false); } } else if (!config.IncludeDefaultEnums) { return(false); } } return(true); }
internal static string GetPropertyName(string propertyName, PropertyConfigs config) { return(config.EmitCamelCaseNames ? propertyName.ToCamelCase() : config.EmitLowercaseUnderscoreNames ? propertyName.ToLowercaseUnderscore() : propertyName); }
internal string GetPropertyName(PropertyConfigs config) { return(config.EmitCamelCaseNames ? propertyNameCLSFriendly : config.EmitLowercaseUnderscoreNames ? propertyNameLowercaseUnderscore : propertyName); }