关于接口使用getType的方法的问题

C#代码如下:
    public interface IConfigInfo
    {
    }
    public class A : IConfigInfo
    {

    }
    public class b
    {
        void bb(IConfigInfo a)
        {
            Type t = a.GetType();
        }
    }

VB.net代码如下:
Public Interface IConfigInfo
End Interface
Public Class A
    Implements IConfigInfo
   
End Class
Public Class b
    Private Sub bb(ByVal a As IConfigInfo)
        Dim t As Type = a.GetType()
    End Sub
End Class
请大家注意红色部分,其中C#代码运行正常,而vb的哪个就是不行,错误原因为:
a.GetType() 提示:GetType不是IConfigInfo 的成员

园子里的筒子:沙加说:
把a 先转成object试试.
----
Dim t As Type = ctype(a,object).GetType()

---
这样子竟然行了。。。。极度郁闷,为什么c#中可以用a.gettype()来获取对象类型,而在vb中不行呢?
posted @ 2007-12-27 16:38  没剑  阅读(754)  评论(1编辑  收藏  举报