?
Solved

PropertyDescriptor.PropertyType check if int ???

Posted on 2005-03-19
5
Medium Priority
?
799 Views
Last Modified: 2008-01-09
How can I check if PropertyDescriptor.PropertyType is type int?
PropertyDescriptor objPropDesc;
... set the objPropDesc ...
and...
if (objPropDesc.PropertyType is Int16 || objPropDesc.PropertyType is Int32 || objPropDesc.PropertyType is Int64)

this if never works...
0
Comment
Question by:glowas
[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
5 Comments
 

Author Comment

by:glowas
ID: 13583303
I did it this way for now, but I don't like it because it is only comparing the type name.
if (objPropDesc.PropertyType.FullName == "System.Int16" .....)
But it works...
Any better solutions?
0
 
LVL 23

Accepted Solution

by:
b1xml2 earned 1500 total points
ID: 13584961
Type t = Type.GetType(objPropDesc.PropertyType.FullName)
if (t == typeof(short))
{
 // short is System.Int16
 ...
}
elseif (t == typeof(int))
{

}
elseif (t == typeof(Int64))
{

}
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

771 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