Solved

Type.GetType problem

Posted on 2008-10-29
2
658 Views
Last Modified: 2013-11-07
Hi!

How do I get the type of partial class?

Namespace Test
   Public Partial Class c1
        Public Partial Class c2
              Public Sub Test
              End Sub
        End Class
   End Class
End Namespace

Dim classType as Type = Type.GetType(Test.c1.c2,false,false)

This will return null!
0
Comment
Question by:AWestEng
  • 2
2 Comments
 
LVL 38

Expert Comment

by:PaulHews
ID: 22835825
Just use the GetType operator:

Dim classType As Type = GetType(Test.c1.c2)
0
 
LVL 38

Accepted Solution

by:
PaulHews earned 500 total points
ID: 22835914
Type.GetType acts on a string name, but you are passing a class type instead of an string.  You can also use:

Dim classType As Type = Type.GetType("WindowsApplication1.Test.c1+c2", False, False)

Note that WindowsApplication1 is the root namespace.  You would have to change it for your program.  The + precedes a nested class

http://msdn.microsoft.com/en-us/library/a87che9d.aspx
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question