我搜索这些所谓的结果的,但没有找到任何有关我的问题。我怀疑这可能是重复的。
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.
System.Type.Missing或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.
似乎都被用来当你想一个参数的默认值传递给互操作程序集...
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
.