Re: Late Binding in C#
From: Scott English (nospam_at_nospam.com)
Date: 04/02/04
- Next message: n3crius: "Re: web.config error! please help!"
- Previous message: John Bowman: "Re: Local Network Interface Monitoring"
- In reply to: Daniel Jin: "RE: Late Binding in C#"
- Next in thread: Willy Denoyette [MVP]: "Re: Late Binding in C#"
- Reply: Willy Denoyette [MVP]: "Re: Late Binding in C#"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 2 Apr 2004 13:00:01 -0800
Do you mean declaring a variable as System.__ComObject? As in
__ComObject o = (__ComObject)someComObject.SomeMethod();
o.MakeLateBoundCallThroughIDispatch();
This doesn't compile. __ComObject isn't a public type. You can't declare a
variable of as __ComObject.
"Daniel Jin" <anonymous@discussions.microsoft.com> wrote in message
news:85B8A945-6409-493B-B02A-CDD777131E75@microsoft.com...
> well, did you try to make the late-bound call through type
System.__ComObject? according to the documentation, you should still be
able to make such a call through this generic type if your object implements
the IDispatch interface.
>
> ----- Scott English wrote: -----
>
> I am writing an C# program. I call a method on a COM object that
returns
> Object. I don't know the type of the object (and reflection just
says its a
> __ComObject), but I know there is supposed to be Controls property.
How can
> I call the Controls property without knowing the type of the object?
>
> In VB.NET, you can just do this if Option Explicit is off by just
writing
> SomeObject.Controls. The VB.NET runtime will handle the late binding
which,
> in this case, includes calling the COM object's IDispatch interface.
I
> don't see how to do the same thing in C#. The only "late binding"
examples
> I can find for C# assume you know the type of the object you are
calling.
>
>
>
- Next message: n3crius: "Re: web.config error! please help!"
- Previous message: John Bowman: "Re: Local Network Interface Monitoring"
- In reply to: Daniel Jin: "RE: Late Binding in C#"
- Next in thread: Willy Denoyette [MVP]: "Re: Late Binding in C#"
- Reply: Willy Denoyette [MVP]: "Re: Late Binding in C#"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|