@@ -47,11 +47,10 @@ public virtual string Serialize(object model, string[] exclusions = null, int ma
47
47
if ( maxDepth < 1 )
48
48
maxDepth = Int32 . MaxValue ;
49
49
50
- var excludedPropertyNames = new HashSet < string > ( exclusions ?? new string [ 0 ] , StringComparer . OrdinalIgnoreCase ) ;
51
50
using ( var sw = new StringWriter ( ) ) {
52
- using ( var jw = new JsonTextWriterWithExclusions ( sw , excludedPropertyNames ) ) {
51
+ using ( var jw = new JsonTextWriterWithExclusions ( sw , exclusions ) ) {
53
52
jw . Formatting = Formatting . None ;
54
- Func < JsonProperty , object , bool > include = ( property , value ) => ShouldSerialize ( jw , property , value , maxDepth , excludedPropertyNames ) ;
53
+ Func < JsonProperty , object , bool > include = ( property , value ) => ShouldSerialize ( jw , property , value , maxDepth , exclusions ) ;
55
54
var resolver = new ExceptionlessContractResolver ( include ) ;
56
55
serializer . ContractResolver = resolver ;
57
56
if ( continueOnSerializationError )
@@ -71,9 +70,9 @@ public virtual object Deserialize(string json, Type type) {
71
70
return JsonConvert . DeserializeObject ( json , type , _serializerSettings ) ;
72
71
}
73
72
74
- private bool ShouldSerialize ( JsonTextWriterWithDepth jw , JsonProperty property , object obj , int maxDepth , ISet < string > excludedPropertyNames ) {
73
+ private bool ShouldSerialize ( JsonTextWriterWithDepth jw , JsonProperty property , object obj , int maxDepth , string [ ] excludedPropertyNames ) {
75
74
try {
76
- if ( excludedPropertyNames != null && ( property . UnderlyingName . AnyWildcardMatches ( excludedPropertyNames , true ) || property . PropertyName . AnyWildcardMatches ( excludedPropertyNames , true ) ) )
75
+ if ( excludedPropertyNames != null && excludedPropertyNames . Length > 0 && ( property . UnderlyingName . AnyWildcardMatches ( excludedPropertyNames , ignoreCase : true ) || property . PropertyName . AnyWildcardMatches ( excludedPropertyNames , ignoreCase : true ) ) )
77
76
return false ;
78
77
79
78
bool isPrimitiveType = DefaultContractResolver . IsJsonPrimitiveType ( property . PropertyType ) ;
0 commit comments