Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

Two questions about "COM"

$
0
0

Hello all:

Just a newbie to COM (Component Object Model) because I began to learn programming based on .NET;) So I summarized several things please confirm "Yes" or "No" with some reasons;)

My C# codes:

namespaceCOMTest
{    publicinterfaceIMyClass    {        int Fun();        int Fun2();    }
[ClassInterface(ClassInterfaceType.None)]    public class MyClass    {        public int Fun()        {            return 3;        }        public int Fun2()        {            return 3;        }    }

Q1:is I cannot understand if I DON'T define the interface and set "Make Assembly COM Visible" = True, Icannot run as:

Dim a As New MyClass
a.Fun()

But I can run with CreateObject method in VB6. Why?

Q2:Without defination of:

[ClassInterface(ClassInterfaceType.None)]

I can write:

Dim a As New MyClass
a.Fun()

And run well, but when I say "a." WITHOUT ANY INTELLISENSE OF FUN", why?


Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>