Type.Missing vs. System.Reflection.Missing.Value as WSF parameters?

F

Fabz

When I want to call an Excel-Worksheetfunction from my C# AutomationAddIn
which takes many parameters (such as SUM), in which case should I use
Type.Missing for the missing parameters and in which case should I use
System.Reflection.Missing.Value instead? Is there a difference in
functionality or performance? I've come across both.

Fabz
 
F

Fabz

I just stumbled upon this. In the book "Visual Studio Tools for Office 2007"
(Eric Carter, Eric Lippert) the authors write:

"In C#, you must pass a special value to optional parameters that are of
type object if you do not want to specify the parameter. This special value
is called System.Type.Missing, and it must be passed for optional parameters
that you do not want to specify directly (unlike Visual Basic in which oyu
can omit the parameter entirely). In VSTO projects, a "missing" variable is
predeclared for you (that is set to System.Type.Missing). Therefore, VSTO
code, you will often see missing pased rather than System.Type.Missing."

Doesn't exactly answer my question, but since the two guys seem to form part
of MS's developer team, they certainly know why they recommend doing it this
way.
Fabz
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top