简体   繁体   English

互操作“强制性”可选参数

[英]Interop “mandatory” optional parameters

Application was built using MS interop, to export .xls to infoPath and vice versa. 应用程序是使用MS interop构建的,可将.xls导出到infoPath,反之亦然。 It was developed in VS 2010, but now transferred to VS 2008. Project fails to build, as the marvellous interop lib, requires a bunch of crappy parameters to be set (although they are marked as optional in msdn). 它是在VS 2010中开发的,但是现在转移到了VS2008。由于无法创建出色的互操作库,需要设置一堆糟糕的参数(尽管在msdn中将其标记为可选),因此项目无法构建。 If putting "null" values, app crashes. 如果输入“ null”值,则应用程序崩溃。 There are no code samples on msdn, resolving this issue. msdn上没有代码示例,可以解决此问题。 So what do I put there? 那我放在那儿呢?

Pass Type.Missing . 传递Type.Missing

If it's a ref parameter, you'll need to declare a variable to pass by reference. 如果它是ref参数,则需要声明一个变量以通过引用传递。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM