问题(C#编译器警告信息):
warning CS0467: 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.
(部分..)解决方案: Compile time warning when using 'Microsoft.Office.Interop.Word._Document.Close'
困境:
如果我明确转换为 Microsoft.Office.Interop.Word._Document
,ReSharper 会警告我“类型转换是多余的”
问题: 这个警告消息是否有真正的解决方案,而不仅仅是拼凑而成?
最佳答案
只是不要转换,C# 不需要它:
Word._Application app = new Word.Application();
Word._Document doc = app.Documents.Add(...);
doc.Close(...); // No ambiguity
app.Quit(...);
关于c# - 使用 'Microsoft.Office.Interop.Word._Document.Close' 时出现警告 CS0467,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10480119/