I am trying to write a simple role playing game in C# to become more familiar with the language.
I have a class that loads data from CSV file, creates an object, and
Derive from DynamicObject and override TryGetMember
so that it returns the appropriate dictionary entry. Exactly what Microsoft did in MVC 3's ViewBag.
Example usage (if your derived type was named CsvBag
):
dynamic bag = new CsvBag(csvFileStream);
_monitor.Monster.LookUp(*bag.Id*).Attack(player); // whatever..