This repository was archived by the owner on Dec 24, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +3
-21
lines changed Expand file tree Collapse file tree 1 file changed +3
-21
lines changed Original file line number Diff line number Diff line change @@ -272,21 +272,6 @@ private static List<T> GetSingleRow(IEnumerable<string> rows, Type recordType)
272
272
return row ;
273
273
}
274
274
275
- private static List < T > ParseSingleRow ( string row , Type recordType )
276
- {
277
- var results = new List < T > ( ) ;
278
- var itemRows = CsvReader . ParseFields ( row ) ;
279
- foreach ( var itemRow in itemRows )
280
- {
281
- var to = recordType == typeof ( string )
282
- ? ( T ) ( object ) itemRow
283
- : TypeSerializer . DeserializeFromString < T > ( itemRow ) ;
284
-
285
- results . Add ( to ) ;
286
- }
287
- return results ;
288
- }
289
-
290
275
public static List < T > GetRows ( IEnumerable < string > records )
291
276
{
292
277
var rows = new List < T > ( ) ;
@@ -375,14 +360,11 @@ public static List<T> Read(List<string> rows)
375
360
headers = CsvReader . ParseFields ( rows [ 0 ] , s => s . Trim ( ) ) ;
376
361
}
377
362
378
- if ( typeof ( T ) . IsValueType || ( typeof ( T ) == typeof ( string ) ) && rows . Count == 1 )
379
- {
380
- return ParseSingleRow ( rows [ 0 ] , typeof ( T ) ) ;
381
- }
382
-
383
363
if ( typeof ( T ) . IsValueType || typeof ( T ) == typeof ( string ) )
384
364
{
385
- return GetSingleRow ( rows , typeof ( T ) ) ;
365
+ return rows . Count == 1
366
+ ? GetSingleRow ( CsvReader . ParseFields ( rows [ 0 ] ) , typeof ( T ) )
367
+ : GetSingleRow ( rows , typeof ( T ) ) ;
386
368
}
387
369
388
370
for ( var rowIndex = headers == null ? 0 : 1 ; rowIndex < rows . Count ; rowIndex ++ )
You can’t perform that action at this time.
0 commit comments