Skip to content

zmmille2/net-Object

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Object

Automagically parses (with reflection) an DataRow/DataTable/Dictionary to a custom class of yours.

using ObjectLibrary;

var users = dataTable.ToObject<User>();

IDictionary<string, object>

using ObjectLibrary;

var userData = new Dictionary<string, object> { { "Name", "John Smith" }, { "Birth", new DateTime(1970, 1, 1) } };
var userObject = userData.ToObject<User>();

IDictionary<string, string>

using ObjectLibrary;

var userData = new Dictionary<string, string> { { "Name", "John Smith" }, { "Birth", "1970-01-01" } };
var userObject = userData.ToObject<User>();

userData["Birth"] = "Not a date!";
var shitHappens = userData.ToObject<User>(); // throws CouldNotParseException

About

Automagically parses (with reflection) an Dictionary/DataRow/DataTable to a custom class of yours.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%