如何消除警告歧义? [英] How to eliminate warning about ambiguity?
本文介绍了如何消除警告歧义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这样的警告:
警告3模糊方法之间的'Microsoft.Office.Interop.Word._Application.Quit(Ref对象,引用对象,参考对象)和非方法Microsoft.Office.Interop.Word.ApplicationEvents4_Event.Quit。使用方法组。
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.
在我行
wordApplication.Quit();
我曾尝试与替换它:
I have tried replacing it with:
wordApplication.Quit(false); // don't save changes
和
wordApplication.Quit(false, null, null); // no save, no format
但它一直给我这个警告。这不是一个巨大的问题,因为code编译完美和功能如预期,但我想摆脱警告。我该怎么办?
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?
推荐答案
显式转换参考类型 _Application
:
((_Application)wordApplication).Quit();
这篇关于如何消除警告歧义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文