Using Type.GetType in an already loaded assembly

T

TN

I have an application that is using System.Windows.Forms. I'd like to
use Type.GetType() to get a Type so I can create an instance of it using
reflection. The only way I can get it to return the type is:

Type tt = Type.GetType(
"System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089");

Since (I assume) when my application is running System.Windows.Forms
assembly is already loaded, there must be a way to get the type from the
loaded assembly, instead of having to specify version/culture/token
information.
Can anyone shed some light on this dim bulb?
Thanks.
 
V

Vladimir Matveev

1. obtain assembly reference for example from
AppDomain.GetAssemblies
2. search type in well-defined assembly
Assembly.GetType
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top