> I have one solution when I make the class implement an interface and
> set ClassInterface attribute to none, thereby the methods are listed as
> part of the interface.
>
> Is it the correct approach?
Yes
> Is there a better approach?
Hmm, ClassInterfaceType.AutoDispatch. I don't get it why it doesn't
work for you under .NET 2.0. Maybe isn't the default value anymore.
> Is it going to cause issues with versioning ie., is it going to break
> user code when we release a new version of this class or any other
> issue?
As usual with COM interfaces: never change them after a public release.
Rob
Zdenek Drlik - 07 Oct 2005 14:46 GMT
>> I have one solution when I make the class implement an interface and
>> set ClassInterface attribute to none, thereby the methods are listed as
[quoted text clipped - 8 lines]
> Hmm, ClassInterfaceType.AutoDispatch. I don't get it why it doesn't
> work for you under .NET 2.0. Maybe isn't the default value anymore.
I think that using ClassInterfaceType instead of explicitly declaring
own interface for class is not better approach. MSDN section
"Introducing the Class Interface":
Using the class interface, instead of explicitly defining your own, can
complicate the future versioning of your managed class. Please read the
following guidelines before using the class interface.
So if you could define own interface for class, do it and set the
ClassInterface to None. It is better and recommended approach:
[C#]
[ClassInterface(ClassInterfaceType.None)]
public class LoanApp : IExplicit {
void M();
}
Zdenek D.
Robert Jordan - 07 Oct 2005 15:06 GMT
Hi Zdenek,
>> Hmm, ClassInterfaceType.AutoDispatch. I don't get it why it doesn't
>> work for you under .NET 2.0. Maybe isn't the default value anymore.
[quoted text clipped - 15 lines]
> void M();
> }
ClassInterfaceType.None will not work with strictly late-bound
clients (VBScript, JScript). Since I don't know much about VBA,
I assumed it problably does strict late-binding as well.
ClassInterfaceType.AutoDispatch is the default under .NET 1.1
and it doesn't have the versioning problems of *AutoDual*.
Rob
manohar.shankar@gmail.com - 07 Oct 2005 19:36 GMT
Thanks for the quick response,
by original question still remains:
Why the methods in the class are not listed through object browser of
Excel VBA, and only the class itself is listed?
I have decided to go ahead with ClassInterface.None approach but I have
some classes which are generated and I have no control over where I can
follow this approach but to somehow make the methods of those classes
list in VBA.
Any ideas?