Skip to content

codereflection/DynoPhile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DynoPhile - A dynamic, ExpandoObject-o-matic, file-to-poco parser, yeah.

The idea is simple. Take a CSV file, sprinkle some dynamic and ExpandoObject magic, and get a list of plain old object back.

Warning - this is a toy and experimental code. Perhaps it will turn into something, perhaps it will not. Who knows.

Usage:

First, add a reference to DynoPhile.dll
For a file with a header: make the call:

var magic = new DynoPhile().ReadFile(fileName, ",");  

for a file without a header, you can supply your own function to build out the dynamic properties:

  
public class DoMagic()
{
	var magic = new DynoPhile().ReadFile(fileName, "|", BuildProperties);
}
		
private static dynamic BuildProperties()
{
	dynamic header = new ExpandoObject();

	header.FirstName = string.Empty;
	header.LastName = string.Empty;
	header.TwitterHandle = string.Empty;

	return header;
}

so given an example CSV file:

"FirstName","LastName","Twitter"
"Jeff","Schumacher","codereflection"
"Bobby","Johnson","notmyself"
"Eric","Ridgeway","ang3lfir3"

DynoPhile will give you dynamic awesome in return:

foreach (var item in magic)
{
	Console.WriteLine("{0} {1}, @{2}", item.FirstName, item.LastName, item.Twitter);
}

About

A dynamic, ExpandoObject-o-matic, file-to-poco parser for .NET 4, yeah.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages