.net - Handling Graphs of Managed Object Proxies to Unmanaged Objects -


My question is similar:

But with a twist.

I have essentially an object graph or a hierarchy, where the owner of some references to several instances of class Foo class bar / P>

I have a managed representation of Foo in .NET, which places IntPtr on the actual Foo and P / Use ions to call methods on foo (working as a proxy).

> Managed implementation of Foo (Proxy) IDisposable .

The list for proxy foo in

Code> Proxy works the same way (actual bar for IntPtr ).

When the original foo is released, it issues all its children (including all the times s).

What's the best way to deal with this scenario - as I do not have to capture the Foo proxy's managed client's reference to bar They want to keep it long and in the context of the Foo proxy.

Maybe I'm more superficially over this, but your bar (proxy) There should be a disposable method in class which is called by the parent / owner Foo class and like many classes, once the bar objects If it has been settled, then it should set an internal m_disposed flag correctly and any exception should be given to the ObjectDisposed followed by the methods Is used If your internal unmanaged resources have been cleaned in the context of your managed bar object, then you do not care needed.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -