0

I'm wondering if C#'s memory management will handle code like the following correctly, or if I have to implement IDisposable or some other method to help make sure that there is no memory leak. The only unusual thing is that UseThings creates an object of DoThings that has a pointer back to a method in UseThings. Thanks.

class DoThings {

    public Action ProcessThing {get; set;}

    public DoThings(Action processThing)
    {
         ProcessThing = processThing;
    }

}

class UseThings {

    protected readonly DoThings Doer;

    public UseThings()
    {
         Doer = new DoThings(DoThingA);
    }

    protected virtual void DoThingA()
    {
         // does things
    }

}

0 Answers0