?
Solved

Type.GetType problem

Posted on 2008-10-29
2
Medium Priority
?
666 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Command Line Tips and Tricks

The command line is a powerful tool at the disposal of every Linux user. Although Linux distros come with beautiful user interfaces, it's worthwhile to learn the command line because it allows you to do a number of things that you otherwise cannot do from the GUI.  

Question has a verified solution.

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

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

752 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