1 min readSep 22, 2020
That is exactly what you should NOT be doing.
The code compiles and works 99% of the time. Then one time you are going to get a runtime error because the native C object has been destroyed but the C# reference is still not set to null and is waiting for garbage collection.