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 +27
-4
lines changed
tests/ServiceStack.Text.Tests Expand file tree Collapse file tree 2 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -165,6 +165,33 @@ public override DateTime ParseXsdDateTimeAsUtc(string dateTimeStr)
165165 // return TimeZoneInfo.ConvertTimeToUtc(dateTime);
166166 //}
167167
168+ #if NETSTANDARD1_3
169+ public override ParseStringDelegate GetSpecializedCollectionParseMethod < TSerializer > ( Type type )
170+ {
171+ if ( type == typeof ( StringCollection ) )
172+ {
173+ return ParseStringCollection < TSerializer > ;
174+ }
175+ return null ;
176+ }
177+
178+ private static StringCollection ParseStringCollection < TSerializer > ( string value ) where TSerializer : ITypeSerializer
179+ {
180+ if ( ( value = DeserializeListWithElements < TSerializer > . StripList ( value ) ) == null ) return null ;
181+
182+ var result = new StringCollection ( ) ;
183+
184+ if ( value != String . Empty )
185+ {
186+ foreach ( var item in DeserializeListWithElements < TSerializer > . ParseStringList ( value ) )
187+ {
188+ result . Add ( item ) ;
189+ }
190+ }
191+
192+ return result ;
193+ }
194+ #endif
168195 public override Type UseType ( Type type )
169196 {
170197 if ( type . IsInterface ( ) || type . IsAbstract ( ) )
@@ -174,7 +201,6 @@ public override Type UseType(Type type)
174201 return type ;
175202 }
176203
177-
178204 public override ParseStringDelegate GetJsReaderParseMethod < TSerializer > ( Type type )
179205 {
180206 if ( type . AssignableFrom ( typeof ( System . Dynamic . IDynamicMetaObjectProvider ) ) ||
Original file line number Diff line number Diff line change @@ -733,9 +733,6 @@ public void Deserialize_array_with_null_elements()
733733 }
734734
735735 [ Test ]
736- #if NETCORE && ! NETSTANDARD1_3
737- [ Ignore ( "StringCollection is available only since netstandard1.3 platform" ) ]
738- #endif
739736 public void Can_serialize_StringCollection ( )
740737 {
741738 var sc = new StringCollection { "one" , "two" , "three" } ;
You can’t perform that action at this time.
0 commit comments