Using C++ Class DLL in C# Application

Simple way assuming class Foo: Create a C++/CLI project, call this FooWrapper. Make FooWrapper depend on the unmanaged dll (however you normally would). Create a managed class ManagedFoo which contains a single private instance field of type Foo*. provide public wrapping functions in ManagedFoo which forward on to the underlying instance field. Optionally (though recommended): … Read more

What exactly are unmanaged resources?

Managed resources basically means “managed memory” that is managed by the garbage collector. When you no longer have any references to a managed object (which uses managed memory), the garbage collector will (eventually) release that memory for you. Unmanaged resources are then everything that the garbage collector does not know about. For example: Open files … Read more