Test type

M

MFRASER

I need a way to test if a type is Double and I am doing the following, but I
have heard that the try, catch has a lot of overhead and slows the system
down. Is this true, and is there a better way to accomplish this?

double Val = System.Double.NegativeInfinity;

string strValue = null;

//Test for string

try

{

Val = Convert.ToDouble(Cols[tmpCounter]);

}

catch

{

//must be string

strValue = Cols[tmpCounter];

}
 

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