Sign in

On many WPF or WinForms applications, when it comes to display data into a table, we are using DataTable class. Recently, I worked on a ASP.NET MVC Backend, where my source was a DataTable and I had to return an IEnumerable<T> to be consumed by a mobile app using Swagger and NSwag Studio. I wanted something simple and efficient to convert my table into an IEnumerable, I had that line of code in mind: myTable[“Users”].ToEnumerable<User>();

And here is my custom implementation, let’s start with how to use it:

The implementation of this class is available on my GitHub.

Let’s…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store