List of Anonymous Types in .Net
While working on an application that uses the great EPPlus library to export data into an Excel 2007/2010 worksheet I came across an interesting problem. I was using an existing function that return a list of patient gift objects (List
I knew that there was a way to use Anonymous Types to construct an object with the desired data. And after a little bit of playing around, I wrote the following code which worked flawlessly:
And with this simple piece of code I was able to generate my data without any issues (see screenshot below) I will update some of the other parts of the code to use this format to remove some duplicate code in the application!
Leave a comment