Type.GetType()

  • Thread starter Thread starter Andrew Chalk
  • Start date Start date
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.
 
Considering specifying the assembly name.

System.Drawing.Color, System.Drawing

Karl
 
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]...
 
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

Similar Threads


Back
Top