Is it possible to use a c# object initializer with a factory method?

前端 未结 7 1635
离开以前
离开以前 2020-12-25 13:06

I have a class with a static factory method on it. I want to call the factory to retrieve an instance of the class, and then do additional initialization, preferablly via c#

7条回答
  •  南笙
    南笙 (楼主)
    2020-12-25 13:28

    No, that's something you can only do 'inline'. All the factory function can do for you is to return a reference.

提交回复
热议问题