Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tallesl/net-object
Automagically parses (with reflection) an Dictionary/DataRow/DataTable to a custom class of yours.
https://github.com/tallesl/net-object
csharp datarow datatable dictionary dot-net nuget object parse reflection
Last synced: 3 months ago
JSON representation
Automagically parses (with reflection) an Dictionary/DataRow/DataTable to a custom class of yours.
- Host: GitHub
- URL: https://github.com/tallesl/net-object
- Owner: tallesl
- Created: 2015-07-06T17:37:49.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-07-24T18:37:53.000Z (over 5 years ago)
- Last Synced: 2024-05-13T16:24:36.852Z (9 months ago)
- Topics: csharp, datarow, datatable, dictionary, dot-net, nuget, object, parse, reflection
- Language: C#
- Homepage:
- Size: 90.8 KB
- Stars: 7
- Watchers: 5
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Object
[![][build-img]][build]
[![][nuget-img]][nuget][build]: https://ci.appveyor.com/project/TallesL/net-object
[build-img]: https://ci.appveyor.com/api/projects/status/github/tallesl/net-object?svg=true
[nuget]: https://www.nuget.org/packages/Object
[nuget-img]: https://badge.fury.io/nu/Object.svgAutomagically parses (with reflection) an DataRow/DataTable/Dictionary to a custom class of yours.
## [DataRow]/[DataTable]
```cs
using ObjectLibrary;var users = dataTable.ToObject();
```[DataRow]: https://msdn.microsoft.com/library/System.Data.DataRow
[DataTable]: https://msdn.microsoft.com/library/System.Data.DataTable## [IDictionary]<string, object>
```cs
using ObjectLibrary;var userData = new Dictionary { { "Name", "John Smith" }, { "Birth", new DateTime(1970, 1, 1) } };
var userObject = userData.ToObject();
```[IDictionary]: https://msdn.microsoft.com/library/System.Collections.IDictionary
## [IDictionary]<string, string>
```cs
using ObjectLibrary;var userData = new Dictionary { { "Name", "John Smith" }, { "Birth", "1970-01-01" } };
var userObject = userData.ToObject();userData["Birth"] = "Not a date!";
var shitHappens = userData.ToObject(); // throws CouldNotParseException
```