Why C#?

A

Alvin Bruney

Apparently, the C# team (rightfully) assumed that VB.NET would become the
language of choice for the task at hand, so they didn't implement the
features at the compiler level like VB.NET and JScript.NET did.

I remember complaining about this rather loudly, but received a lot of
hogwash that didn't seem to be correct to me and the often repeated advice
to *wrap the object in a C# class. While that works, it is untidy and
alienates C# developers. I believe the compiler team could have met us
half-way. My complaints went nowhere because on the grand scheme of things,
I'm not important.

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
 
A

Alvin Bruney

Next time, i'll try to be more thoughtful in my choice of words. I certainly
did not mean it that way.

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------
 
G

Guest

Jason, I can explain what Alvin is trying to say. The Office object model
uses a lot of optional parameters that are passed by reference.

For example, using VSTO 2005, if you wanted to invoke spell check in a Word
document, the "CheckSpelling()" method accepts 12 optional parameters. All
12 of these optional parameters are passed by reference. Since VB.NET
support optional parameters, you can easily invoke spell check by:

Me.CheckSpelling()

However, C# does not support optional parameters and you have to have all 12
parameters a boxed version of a "null" called "missing" like so:

this.CheckSpelling(ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing);

The Office Object Model is full of methods like this. I'm fluent in both C#
and VB.NET. I perfer C# in general, but when it comes to Office Development,
I use VB.NET because the code is more readable. I also find it silly that I
have to pass in 12 parameters, even though I'm not using them.

Hope this clears things up.
 

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