By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,573 Members | 1,760 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,573 IT Pros & Developers. It's quick & easy.

How to kill COM object in .NET

P: n/a
Using the following codes:

-----Original Message-----

I used following codes in vbscript and VB6 to create/kill
COM object, and it works successfully.

Dim App
Set App = CreateObject("App")
Set App = Nothing

The equivalent codes in .NET are:

Dim App
App = CreateObject("App")
App = Nothing

However, at last line, the instance of App could not be
removed, any body can help me?



Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a

"Li Pang" <li*****> wrote in message
Using the following codes:

This will work, but you should know that it freezes all the threads in your
process for the duration of the GC.Collect(). So you should be very careful
in running this in a multi-threaded environment such as COM+ or ASP.NET.

System.Runtime.InteropServices.Marshal.ReleaseComO bject(App)

is probably all you need. This decrements the ref count on the COM object
to 0, and invokes any destructors on the object.

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.