Marshal.ReleaseCOMObject

Ce faceti cind instanta de Excel nu moare , desi setati toate la NULL ?

Utilizati

Marshal.ReleaseComObject

Atentie sa faceti la TOATE obiectele ( hint: Daca aveti doua puncte, aveti doua obiecte)

De ex:

var a=new Application();
var w = a.Workbooks.Add();

Se va transofrma in

var a=new Application();
var ws = a.Workbooks;
var w = ws.Add();
//code
Marshal.ReleaseComObject(w);
w = null;
Marshal.ReleaseComObject(ws);
ws = null;

Video la https://youtu.be/wOQLimzYqAM

Surse la https://github.com/ignatandrei/ToolsAndUtilities


			

Leave a Reply

Your email address will not be published. Required fields are marked *