This repository was archived by the owner on Dec 24, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
src/ServiceStack.Text/Common
tests/ServiceStack.Text.Tests Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -284,9 +284,9 @@ public WriteObjectDelegate GetValueTypeToStringMethod(Type type)
284
284
{
285
285
if ( underlyingType . IsEnum )
286
286
{
287
- if ( type . HasAttribute < DataContractAttribute > ( ) )
287
+ if ( underlyingType . HasAttribute < DataContractAttribute > ( ) )
288
288
return Serializer . WriteEnumMember ;
289
- if ( type . HasAttribute < FlagsAttribute > ( ) )
289
+ if ( underlyingType . HasAttribute < FlagsAttribute > ( ) )
290
290
return Serializer . WriteEnumFlags ;
291
291
return Serializer . WriteEnum ;
292
292
}
Original file line number Diff line number Diff line change @@ -229,6 +229,8 @@ public enum Day
229
229
class EnumMemberDto
230
230
{
231
231
public Day Day { get ; set ; }
232
+
233
+ public Day ? NDay { get ; set ; }
232
234
}
233
235
234
236
[ Test ]
@@ -256,6 +258,21 @@ public void Does_serialize_EnumMember_enum()
256
258
Assert . That ( Day . Sunday . ToJson ( ) , Is . EqualTo ( "\" SUN\" " ) ) ;
257
259
Assert . That ( Day . Sunday . ToJsv ( ) , Is . EqualTo ( "SUN" ) ) ;
258
260
Assert . That ( Day . Sunday . ToCsv ( ) , Is . EqualTo ( "SUN" ) ) ;
261
+
262
+ Assert . That ( ( ( Day ? ) Day . Sunday ) . ToJson ( ) , Is . EqualTo ( "\" SUN\" " ) ) ;
263
+ Assert . That ( ( ( Day ? ) Day . Sunday ) . ToJsv ( ) , Is . EqualTo ( "SUN" ) ) ;
264
+ Assert . That ( ( ( Day ? ) Day . Sunday ) . ToCsv ( ) , Is . EqualTo ( "SUN" ) ) ;
265
+ }
266
+
267
+ class Test
268
+ {
269
+ public double Double { get ; set ; }
270
+ }
271
+
272
+ [ Test ]
273
+ public void METHOD ( )
274
+ {
275
+ new Test { Double = 204753574.10189867 } . ToJson ( ) . Print ( ) ;
259
276
}
260
277
261
278
}
You can’t perform that action at this time.
0 commit comments