user101375
user101375

Reputation: 7079

How to get a Type object from Type's name?

This is my code:

using System.Windows.Forms;

Type type = typeof(Form);
Type type2 = Type.GetType(type.FullName);

As a result: type2==null

What I am doing wrong?

Upvotes: 2

Views: 245

Answers (1)

Lucian
Lucian

Reputation: 4001

Maybe you could try:

Type type2 = Type.GetType(type.AssemblyQualifiedName);

Upvotes: 7

Related Questions