How can I write a generic container class that implements a given interface in C#?

后端 未结 7 1747
太阳男子
太阳男子 2020-12-02 16:17

Context: .NET 3.5, VS2008. I\'m not sure about the title of this question, so feel free to comment about the title, too :-)

Here\'s the scenario: I have several cla

7条回答
  •  佛祖请我去吃肉
    2020-12-02 16:21

    You could wait for C# 4.0 and use dynamic binding.

    This is a great idea - I've had to implement this for IDisposable on several occasions; when I want many things to be disposed. One thing to keep in mind though is how errors will be handled. Should it log and keep starting others, etc... You'd need some options to give the class.

    I'm not familiar with DynamicProxy and how it could be used here.

提交回复
热议问题