Solved

Type.GetType problem

Posted on 2008-10-29
2
665 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 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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

688 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