Re: Why C#?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Note that Office applications are COM automation servers, they were designed
to be scripted, that is, the interfaces are to be consumed by (late bound)
scripting clients like VBScript and non scripting (late & early bound)
languages like VBA, VB and C++ which all do support late binding, optional
and named arguments.
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.

Willy.



"Jason Newell" <nospam@xxxxxxxxxx> wrote in message
news:%23fnZI$mXGHA.2376@xxxxxxxxxxxxxxxxxxxxxxx
| Alvin & All,
|
| Thanks for the responses. My main source of COM Interop interaction is
| via CAD applications. I develop solutions using both C# & VB.NET and I
| guess I just hadn't noticed that big of a difference that would make me
| say one language handles COM Interop better than the other.
|
| I guess I just got hung up on the "C# lacks some support where VB.NET
| does". When I read it, it implied to me that VB.NET can accomplish COM
| Interop tasks that C# can't. They can both accomplish the same tasks,
| but sometimes using different methods. All that said, I now understand
| your scenerio.
|
| Thanks for the input.
|
| Jason Newell
|
| Alvin Bruney wrote:
| >>I believe it's just a case of VB.NET supporting optional parameters and
| >>"loose typing"
| >
| > That's about the sum of it. But while i'm here, i'll add that .NET
enforces
| > pass by value semantics. For MS Word (not Excel) API require pass by
| > reference, C# stumbles because these objects require a reference be
added
| > everytime. Imagine typing ref 30 times in order to satisfy the compiler
for
| > the open workbook method?
| >
| > Further, only lvalues can be passed by reference otherwise the compiler
| > barks really loudly. The sum total of this results in an exercise of
torture
| > for C# developers building real world Office apps in .NET.
| >
| > C# also stumbles for properties that accept more than one parameter
while VB
| > handles this with grace. In fact, you will see numerous get_object and
| > set_object methods in C# for the Office PIA's to fix this evil. A couple
| > other things can go here as well but it's enough to bake the point in.
| >
| > Although the literature will not come out and explicitly tell you so, it
is
| > wise to avoid C# for Office based apps because it is inferior for Office
| > automation in the current context.


.



Relevant Pages

  • Re: beginner Qs about COM/.NET (context = exposing a pre-existing app to scripting)
    ... > therefore contain mutexes to access the serial port. ... Scripting languages, at the moment, only can deal with COM objects. ... > sense to me how reference counting fits into the picture. ... you don't need a mutex at all. ...
    (microsoft.public.vc.atl)
  • Re: vbs output to txt file
    ... the reference count to that object will be decremented. ... As does going out of scope:) ... You are religiously setting objects to nothing and not ... and so am seriously lacking in both scripting expertise ...
    (microsoft.public.scripting.wsh)
  • Re: Problem creating a filesystem object
    ... Is it possible that scripting is disabled on your computer as a security ... Check that the reference is still present: ... Ensure that "Microsoft Scripting Runtime" item is checked. ... The "Add Reference" dialog box normally opens in Windows System ...
    (microsoft.public.powerpoint)
  • Web Interface Brain Buster Problem (for me at least :)
    ... I have to enter it into the fields seperatly then triger the scripting ... server processing and for data consistancy (By locking the record and ... is there a way I can reference the componets inside a page to manualy ...
    (microsoft.public.excel.programming)
  • Re: Can Someone Change My Mind About .NET?
    ... > When I made that reference (and I think the reference that Mike is referring ... That has nothing to do with scripting - it's just being RAD-oriented. ... script programmer that your colleagues do. ...
    (microsoft.public.dotnet.general)