The creation of an object often
requires complex processes not
appropriate to include within a
composing object. The object’s
creation may lead to a significant
duplication of code,may require
information not accessible to the
composing object,may not provIDe a
sufficIEnt level of abstraction,or
may otherwise not be part of the
composing object’s concerns.Some of the processes required in the
creation of an object include
determining which object to create,
managing the lifetime of the object,
and managing specialized build-up and
tear-down concerns of the object.
Activator.CreateInstance不解决任何这些问题,它只允许您创建类型的新实例.如果您没有上述问题(并且“工厂模式”的许多用法不在此类问题的上下文中),Activator.CreateInstance将没问题.
总结以上是内存溢出为你收集整理的c# – Activator.CreateInstance vs Factory Pattern全部内容,希望文章能够帮你解决c# – Activator.CreateInstance vs Factory Pattern所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)