Today I Learned #2Posted: July 3, 2015
Well… Admit I didn’t get much done in my free time today, played Civ V instead.
Also started playing Bravely Default, just got to the second boss. The system is nice but this boss is really annoying. Status effects everywhere, and the fact that the boss can store and release multiple heavy AoE attacks in a row was not a fun realization. It’s mildly interesting so far, I’ll see where it goes.
Learned about C# Reflection, man that was nice. Weird I didn’t feel the need to use it until now, used it with an ASP.Net web forms project. So you have a form, it’s got a bunch of controls, and you’ve got to save/update a database row with a large number of columns. Each form submission updates one of these rows. It gets really tedious binding each data column to each control manually.
C# reflection comes in where you dynamically get a list of properties (and as I learned soon after, fields), give your controls IDs that can be matched up to the DB column names, and then loop through and populate the form / gather fields from the form. It sure makes things a lot neater than having line upon line of individual form/data binding.