Created
June 21, 2017 06:25
-
-
Save darkthread/d0422d17efde5d3e95c4ce4173c70e69 to your computer and use it in GitHub Desktop.
FromCsv issue on unmatched { or [
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Linq; | |
using ServiceStack; | |
using ServiceStack.Text; | |
using System.Collections.Generic; | |
using ServiceStack.Text.Common; | |
public class POCO { | |
public string Prop1 { get; set; } | |
public string Prop2 { get; set; } | |
public string Prop3 { get; set; } | |
public string Prop4 { get; set; } | |
public string Prop5 { get; set; } | |
} | |
var srcList = new List<POCO>() { | |
new POCO() | |
{ | |
Prop1 = "1", | |
Prop2 = JsWriter.ListStartChar + "2", | |
Prop3 = JsWriter.MapStartChar + "3", | |
Prop4 = "4", | |
Prop5 = "5" | |
} | |
}; | |
var csv = CsvSerializer.SerializeToCsv<POCO>(srcList); | |
var desList = csv.FromCsv<List<POCO>>(); | |
var src = srcList[0]; | |
var des = desList[0]; | |
$"Compare Prop5: src={src.Prop5}, des={des.Prop5}".Print(); | |
if (src.Prop5 != des.Prop5) "Deserialization Test Failed!".Print(); | |
// Save a copy of this *public* Gist by clicking the "Save As" below |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<packages> | |
<package id="ServiceStack.Text" version="4.5.8" targetFramework="net45" /> | |
<package id="ServiceStack.Client" version="4.5.8" targetFramework="net45" /> | |
<package id="ServiceStack.Interfaces" version="4.5.8" targetFramework="net45" /> | |
</packages> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment