Hi,

This is the code that I have. This code is called by a background worker.

Code:
private static void RefreshProperties(System.ComponentModel.BackgroundWorker worker, DoWorkEventArgs e)
        {
            using (MsWord word = new MsWord())
            {
                foreach (WordTemplate tmp in WordTemplates)
                    {
                        if (Worker != null && Worker.CancellationPending)
                        {
                            e.Cancel = true;
                            return;
                        }
                        tmp.CustomProperties = word.ReadDocumentCustomProperties(tmp);
                    }
            }
        }
The problem is that WordTemplates is being refreshed while the background worker is doing its thing and it generates an error. Is there any way I can lock WordTemplates property until the background worker is done?

Thanks,

MA