Skip to content

Commit

Permalink
New Examples final 3.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcosMeli committed Aug 2, 2015
1 parent acb59d2 commit d53663d
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Build/CurrentVersion.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
properties {
$CurrentVersion = "3.1.1"
$CurrentVersion = "3.1.2"
$FullCurrentVersion = $CurrentVersion + ".0"
$VisibleVersion = $CurrentVersion + "-rc2"
$VisibleVersion = $CurrentVersion + ""
}
58 changes: 58 additions & 0 deletions FileHelpers.Examples/Examples/10.QuickStart/70.Autoproperties.cs
Original file line number Diff line number Diff line change
@@ -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<Orders>();
var records = engine.ReadFile("Input.txt");

foreach (var record in records)
{
Console.WriteLine(record.CustomerID);
Console.WriteLine(record.OrderDate);
Console.WriteLine(record.Freight);
}
//-> /File
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
1 change: 1 addition & 0 deletions FileHelpers.Examples/FileHelpers.Examples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
<Compile Include="Examples\25.ErrorHandling\10.ErrorMode.ThrowException.cs" />
<Compile Include="Examples\25.ErrorHandling\30.ErrorMode.IgnoreAndContinue.cs" />
<Compile Include="Examples\25.ErrorHandling\40.ErrorMode.SaveAndContinue.cs" />
<Compile Include="Examples\10.QuickStart\70.Autoproperties.cs" />
<Compile Include="Examples\50.Advanced\50.SmartFormatDetector.cs" />
<Compile Include="Examples\50.Advanced\10.MultipleDelimiters.cs" />
<Compile Include="Examples\50.Advanced\30.MultiRecordSample.cs" />
Expand Down

0 comments on commit d53663d

Please sign in to comment.