Type.GetType()

A

Andrew Chalk

After the following line:

Type myType1 = Type.GetType("System.Drawing.Color");

myType1 is "undefined". Why is this? I expected it to be type
System.Drawing.Color.

Many thanks.
 
K

Karl Seguin [MVP]

Considering specifying the assembly name.

System.Drawing.Color, System.Drawing

Karl
 
A

Andrew Chalk

Thanks. Same result.

Is there any other way to check that type of an object? Or to manually
construct a Type to test an object.GetType() against?

- A

"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:%[email protected]...
 
K

Karl Seguin [MVP]

How odd, it worked for me. You might need to specify the fully quantified
name if it's sitting in the GAC, meaning passing in a public token, culture,
version....

you can check what type an object is via the "is" operator

if (myObject is Drawing)
{
}

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/


Andrew Chalk said:
Thanks. Same result.

Is there any other way to check that type of an object? Or to manually
construct a Type to test an object.GetType() against?

- A

"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:%[email protected]...
 

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

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top