Beispiel #1
0
            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);
            }
Beispiel #2
0
 internal static string GetPropertyName(string propertyName, PropertyConfigs config)
 {
     return(config.EmitCamelCaseNames
         ? propertyName.ToCamelCase()
         : config.EmitLowercaseUnderscoreNames
             ? propertyName.ToLowercaseUnderscore()
             : propertyName);
 }
Beispiel #3
0
 internal string GetPropertyName(PropertyConfigs config)
 {
     return(config.EmitCamelCaseNames
         ? propertyNameCLSFriendly
         : config.EmitLowercaseUnderscoreNames
             ? propertyNameLowercaseUnderscore
             : propertyName);
 }