Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to eliminate warning about ambiguity?

I have this warning:

Warning 3 Ambiguity between method 'Microsoft.Office.Interop.Word._Application.Quit(ref object, ref object, ref object)' and non-method 'Microsoft.Office.Interop.Word.ApplicationEvents4_Event.Quit'. Using method group.

on my line

wordApplication.Quit(); 

I have tried replacing it with:

wordApplication.Quit(false); // don't save changes 

and

wordApplication.Quit(false, null, null); // no save, no format 

but it keeps giving me this warning. It's not a huge problem because the code compiles perfectly and functions as expected, but I'd like to get rid of the warnings. What can I do?

like image 323
user1002358 Avatar asked Nov 28 '11 23:11

user1002358


1 Answers

Explicitly cast the reference to the type _Application:

((_Application)wordApplication).Quit();  
like image 59
phoog Avatar answered Oct 14 '22 20:10

phoog