Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Finding decimal value
Message
De
29/05/2011 11:47:49
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01512198
Message ID:
01512208
Vues:
40
>>>How cal i find out returned answer is integer or decimal value..!!!!
>>>
>>>Thanks...
>>
>>The return type will, obviously, always be double. But maybe for what I think you are asking:
bool IsInt = ((int)ans) == ans;
but you should check that ans is not outside the integer range
>
>I was thinking you may try using Int.TryParse

That would require converting the double to a string so would probably be slower. OTOH if you actually wanted to convert to the int type.....
int i2;
bool IsInt = int.TryParse(ans.ToString(),out i2);
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform