C#: instantiating classes from XML

前端 未结 8 767
情歌与酒
情歌与酒 2021-02-04 09:05

What I have is a collection of classes that all implement the same interface but can be pretty wildly different under the hood. I want to have a config file control which of the

相关标签:
8条回答
  • 2021-02-04 09:43

    I recently did something very similar, I used an abstract factory. In fact, you can see the basic concept here:

    Abstract Factory Design Pattern

    0 讨论(0)
  • 2021-02-04 09:49

    Reflection is what you want. Reflection + TypeConverter. Don't have much more time to explain, but just google those, and you should be well on your way. Or you could just use the xml serializer, but then you have to adhere to a format, but works great.

    0 讨论(0)
提交回复
热议问题