带有跨对象动作调用的.Net内存含义

时间:2014-03-04 18:58:39

标签: .net

给出两个对象

public sealed class Master
{
    Action<string> RenderDetail;
}

public sealed class Detail
{
    void RenderDetail(string text) { //some stuff }
}

如果我在master上设置RenderDetail Action,就像这样:

public sealed class MasterSettings
{
    private Master _MasterInstance;
    private void SomeMethod()
    {
        DetailList detail = new DetailList();
        _MasterInstance.RenderDetail = detail.RenderDetail;
    }
}

它有效,但记忆含义是什么? 如果在SomeMethod调用后销毁详细列表实例,MasterInstance如何调用detail方法?

谢谢!

0 个答案:

没有答案