使用“Microsoft.Office.Interop.Word._Document.Close”当编译时警告 [英] Compile time warning when using 'Microsoft.Office.Interop.Word._Document.Close'
问题描述
任何人都知道如何解决这个警告信息?
办法Microsoft.Office.Interop.Word._Document.Close(Ref对象,引用对象,参考对象)和非方法之间的模糊'Microsoft.Office.Interop.Word.DocumentEvents2_Event.Close。使用方法组。
块引用>解决方案我已经设法解决该警告的唯一方法是使用显式转换:
VAR doc_close =(Microsoft.Office.Interop.Word._Document)_doc;
doc_close.Close();如果您已经有一个
使用
为的Microsoft.Office.Interop.Word
可以简化投地:VAR doc_close =(_document)_doc;
doc_close.Close();甚至只是
((_文档)_doc).Close();
Anyone know how to solve this warning message?
Ambiguity between method 'Microsoft.Office.Interop.Word._Document.Close(ref object, ref object, ref object)' and non-method 'Microsoft.Office.Interop.Word.DocumentEvents2_Event.Close'. Using method group.
解决方案The only way I've managed to resolve the warning is to use an explicit cast:
var doc_close = (Microsoft.Office.Interop.Word._Document) _doc; doc_close.Close();
If you already have a
using
forMicrosoft.Office.Interop.Word
you can simplify the cast to:var doc_close = (_Document) _doc; doc_close.Close();
or even just
((_Document)_doc).Close();
这篇关于使用“Microsoft.Office.Interop.Word._Document.Close”当编译时警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!