Reputation: 559
I'm trying to use reflection to get the instance of a class in vb.net. I have a class 'A' in my web project and to test it, i create a new aspx page and try to write the following:
Dim t as Type = Type.GetType("A")
This returns "Nothing". But if i do this:
Dim inst as A = new A()
Dim t as Type = inst.GetType()
t's type is "A"
So how come i can't get the type with GetType even if the name is exactly the same? It does works for things like System.Math though so i'm probably missing something as a newbie.
Upvotes: 0
Views: 1806
Reputation: 1503924
Two things:
So for instance, to get hold of System.Linq.Enumerable
you'd need something like:
Type.GetType("System.Linq.Enumerable, System.Core, Version=4.0.0.0, " & _
"Culture=neutral, PublicKeyToken=b77a5c561934e089")
Upvotes: 3