Filling model properties using Reflection

In this topic I’m going to show how to fill object properties using reflection no matter what types they are.

Let’s take some example. Say, we have some input CSV file with header and values:

Manufacturer;Model;Color;OS;ReleaseDate;Rating
HTC;Titan;Black;Windows Phone 7.5;20111007;10.0
Samsung;Galaxy S3;White;Android 4.0.4;20120529;9.8
Nokia; Lumia 920;Yellow;Windows Phone 8;20121102;9.9

We are going to operate with these values in our application. First of all we need to parse each line. It can be done manually or using some existing library. Parsed values we can store in a dictionary, for instance. Anyway, it’s not a question of the topic.

Continue reading Filling model properties using Reflection