From d53663d787e12038e0c288a199e4ef594a4fcde7 Mon Sep 17 00:00:00 2001 From: Marcos Meli Date: Sun, 2 Aug 2015 19:40:34 -0300 Subject: [PATCH] New Examples final 3.1 release --- Build/CurrentVersion.ps1 | 4 +- .../10.QuickStart/70.Autoproperties.cs | 58 +++++++++++++++++++ .../50.Advanced/30.MultiRecordSample.cs | 2 +- .../FileHelpers.Examples.csproj | 1 + 4 files changed, 62 insertions(+), 3 deletions(-) create mode 100644 FileHelpers.Examples/Examples/10.QuickStart/70.Autoproperties.cs diff --git a/Build/CurrentVersion.ps1 b/Build/CurrentVersion.ps1 index c826c0481..22248e475 100644 --- a/Build/CurrentVersion.ps1 +++ b/Build/CurrentVersion.ps1 @@ -1,5 +1,5 @@ properties { - $CurrentVersion = "3.1.1" + $CurrentVersion = "3.1.2" $FullCurrentVersion = $CurrentVersion + ".0" - $VisibleVersion = $CurrentVersion + "-rc2" + $VisibleVersion = $CurrentVersion + "" } \ No newline at end of file diff --git a/FileHelpers.Examples/Examples/10.QuickStart/70.Autoproperties.cs b/FileHelpers.Examples/Examples/10.QuickStart/70.Autoproperties.cs new file mode 100644 index 000000000..392f53089 --- /dev/null +++ b/FileHelpers.Examples/Examples/10.QuickStart/70.Autoproperties.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using FileHelpers; + +namespace ExamplesFx +{ + //-> Name: Autoproperties + //-> Description: You can use autoproperties instead of fields + + public class AutopropertiesSample + : ExampleBase + { + + //-> If you have a source file like this, separated by a |: + + //-> FileIn:Input.txt +/*10248|VINET|04071996|32.38 +10249|TOMSP|05071996|11.61 +10250|HANAS|08071996|65.83 +10251|VICTE|08071996|41.34*/ + //-> /FileIn + + + //-> You can use autoproperties but for the moment you can't use Converters + + //-> File:RecordClass.cs + [DelimitedRecord("|")] + public class Orders + { + public int OrderID { get; set; } + + public string CustomerID { get; set; } + + public string OrderDate { get; set; } + + public string Freight { get; set; } + } + + //-> /File + + public override void Run() + { + //-> File:Example.cs + var engine = new FileHelperEngine(); + var records = engine.ReadFile("Input.txt"); + + foreach (var record in records) + { + Console.WriteLine(record.CustomerID); + Console.WriteLine(record.OrderDate); + Console.WriteLine(record.Freight); + } + //-> /File + } + + } +} \ No newline at end of file diff --git a/FileHelpers.Examples/Examples/50.Advanced/30.MultiRecordSample.cs b/FileHelpers.Examples/Examples/50.Advanced/30.MultiRecordSample.cs index 34437f565..0fc7314e7 100755 --- a/FileHelpers.Examples/Examples/50.Advanced/30.MultiRecordSample.cs +++ b/FileHelpers.Examples/Examples/50.Advanced/30.MultiRecordSample.cs @@ -11,7 +11,7 @@ namespace ExamplesFx public class MultiRecordSample : ExampleBase { - //-> The idea of this engine is to parse files with different record types (this engine doesn't use any hierarical structure like the master-details, all the records are in linear relation for it). + //-> The idea of this engine is to parse files with different record types (this engine doesn't use any hierarchical structure like the master-details, all the records are in linear relation for it). //-> With the MultiRecordEngine you can parse also mixed delimited and fixed length records. //-> For example, you can parse this strange file: diff --git a/FileHelpers.Examples/FileHelpers.Examples.csproj b/FileHelpers.Examples/FileHelpers.Examples.csproj index e5ef57f26..3f9edad64 100644 --- a/FileHelpers.Examples/FileHelpers.Examples.csproj +++ b/FileHelpers.Examples/FileHelpers.Examples.csproj @@ -85,6 +85,7 @@ +