English

FAQ: Do I have to explicitly instantiate a singleton?

Question

Do I have to explicitly instantiate a singleton?

Answer

Sometimes, when using the new keyword to instantiate a COM object, a reference to an object that already exists is returned. This happens when attempting to instantiate a singleton class that has previously been instantiated. The solution is to use the Activator class to safely wrap singleton objects in a strongly typed runtime callable wrapper (RCW), when a reference to them is first obtained.

Related Information