System.Type.Missing或System.Reflection.Missing.Value与Office PIA工作时? [英] System.Type.Missing or System.Reflection.Missing.Value when working with Office PIA?

查看:385
本文介绍了System.Type.Missing或System.Reflection.Missing.Value与Office PIA工作时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索这些所谓的结果的,但没有找到任何有关我的问题。我怀疑这可能是重复的。

I searched these SO results and couldn't find anything related to my question. I doubt this could be a duplicate.

我目前正在写一个Microsoft.Office.Interop.Excel PIA包装器.NET C#3.5,并想知道什么是最好的,同时呼吁像打开一个给定的工作簿的方法来使用。

I'm currently writing a Microsoft.Office.Interop.Excel PIA wrapper in .NET C# 3.5 and was wondering about what is best to use while calling methods like opening a given workbook.

<一个href="http://msdn.microsoft.com/en-us/library/system.type.missing.aspx"><$c$c>System.Type.Missing或<一href="http://msdn.microsoft.com/en-us/library/system.reflection.missing.value.aspx"><$c$c>Missing.Value?

我已经进行了一些谷歌搜索,并不能找到任何区别,只不过一个是从系统命名空间( System.Type.Missing 的),而其他(的 Missing.Value 的)来自的System.Reflection 命名空间。

I have performed a few Google searches, and can't find any difference, except that one is from the System namespace (System.Type.Missing), and the other (Missing.Value) comes from the System.Reflection namespace.

  1. 是什么,主要的区别,如果有的话,在两者之间?
  2. 在何种情况下一个是最好的比其他使用?
  3. 为什么会这样呢?

似乎都被用来当你想一个参数的默认值传递给互操作程序集...

Both seem to be used when you want to pass a parameter's default value to the interop assembly...

谢谢您的回答! =)

推荐答案

他们是相同的。在键入的静态初始化,现场缺少设置为 System.Reflection.Missing .value的

They are the same. In the static initializer of Type, the field Missing is set to System.Reflection.Missing.Value.

至于为什么有越来越相同值的方法有两种:谁知道。这是相当可能的,这是一个向后兼容残余,如 Type.Missing 的类型为对象,而 Missing.Value 键入缺少

As for why there are two ways of getting at the same value: who knows. It's quite likely that this is a backward compatibility remnant, as Type.Missing is typed as object, whereas Missing.Value is typed Missing.

这篇关于System.Type.Missing或System.Reflection.Missing.Value与Office PIA工作时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆