Generate properties programmatically

前端 未结 7 844
难免孤独
难免孤独 2021-01-04 17:47

I want to load a properties file (it\'s a .csv file having on each line a name and associated numeric value) and then access those property values like so: FileLoader

7条回答
  •  醉酒成梦
    2021-01-04 18:50

    This is possible with the new dynamic stuff in c# 4.0. I'm not an expert, but with dynamic objects you can define behavior for when a method that does not exist is evoked. This post shows a pretty fun example of how to set up a dynamic dictionary that could do what you want.

提交回复
热议问题