为什么不在构造函数中调用可覆盖的方法?

时间:2014-10-27 19:05:05

标签: c# constructor visual-studio-2013 override

我找到了上一篇文章: Why do not call overridable methods in constructors?

我有一个特定的问题:是否可以避免将被调用的方法直接注入构造函数本身?

这是一个可行的解决方案吗?任何方面/不良影响?

我正在考虑以下内容:

public abstract class GenericDataEventArgs<T> : EventArgs
{
    public readonly T  EventInfo;
    public GenericDataEventArgs(T newInfo, Func<T,T> anInjectedFunction)
    {            
         EventInfo = anInjectedFunction(newInfo);
    }
}

0 个答案:

没有答案
相关问题