Yes, unless you wait until the GC clears it.
It is worth noting that the COM interaction creates one COM link to the interface.
IMyInterface x = MyCOMClass.GetData();
IMyOtherInterface y = (IMyOtherInterface)x;
IMyInterface z = x;
Marshal.ReleaseComObject(x);
Marshal.ReleaseComObject(y);
or Marshal.FinalReleaseComObject (x); // If you know that no one is using it
source
share