RCW & reference counting when using COM interop in C#

后端 未结 5 2055
孤独总比滥情好
孤独总比滥情好 2020-12-04 15:46

I have an application that uses Office interop assemblies. I am aware about the \"Runtime Callable Wrapper (RCW)\" managed by the runtime. But I am not very sure how the ref

5条回答
  •  臣服心动
    2020-12-04 16:30

    You need to call Marshal.ReleaseComObject on your wrd variable to release your reference to the word application.

    That way if Word is not visible and you shut your application, the exe will unload as well unless you have made it visible to the user.

提交回复
热议问题