Reputation: 4611
I have developed a sample app on converting the doc to pdf file.But i just want to know the meaning of this statement
object Unknown=Type.Missing;
MSDOC.Documents.Open(ref Source, ref Unknown,
ref Unknown, ref Unknown, ref Unknown,
ref Unknown, ref Unknown, ref Unknown,
ref Unknown, ref Unknown, ref Unknown,
ref Unknown, ref Unknown, ref Unknown,
ref Unknown, ref Unknown);
why do we write the "ref Unknown" Please explain me .Thanks in advance
Upvotes: 1
Views: 186
Reputation: 7823
Before the advent of Net 4.0 there was no way to specify methods with default arguments. However, COM (which you are calling here) does support default arguemnts. Hence Type.Missing is a way of getting around this C# limitation (i.e. Type.Missing is a way of saying use default for the optional parameters).
Upvotes: 6