Ben Voigt [C++ MVP]
8/25/2007 6:28:00 AM
"Juan Dent" <juanjr@nospam.nospam> wrote in message
news:E795B002-231C-4EA7-94A7-E08327E5DB34@microsoft.com...
> Hi,
>
> I have an interface that uses generics in its methods:
>
> [ComVisible(false)]
> public interface IGenericProperty
> {
> bool GetProperty<T>(string propName, out T value);
> }
>
> I have marked it [ComVisible(false)] because COM can't handle generics.
> However the class that implements it is inside an assembly that is built
> with COM Interop On, because it implements both COM usable interfaces and
> pure .NET interfaces like the one above.
>
> However, it gives me warnings at compile time (more exactly at Interop
> registration time) even if I place the same attribute (ComVisible(false))
> to
> the implementing methods. It seems once the class is seen as
> COM-consumable,
> it tries to export to COM all the interfaces it implements, like:
>
> [ClassInterface(ClassInterfaceType.None)]
> [Guid("33D64EF2-5CA7-49F2-A5D8-EC3E2E95BAC9")]
> public class PersistentObject : IPersistentObject, IGenericProperty
>
>
> What can I do to better mix and have the best of both worlds (especially
> the
> best of .NET)?
What if you made the interface ComVisible, but the methods inside not?
>
> --
> Thanks in advance,
>
> Juan Dent, M.Sc.