Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
how could I check the quantity value is decimal or not
 
For Example:
 
Qty may be 0.5 or 1.0 or 1.5
 
if Qty is 0.5 or 1.5,
 
I want to plus 0.5 to get integer value as
Qty is 1.0 or 2.
Posted 25-Dec-12 2:17am
ttds755
Comments
Sergey Alexandrovich Kryukov at 25-Dec-12 16:01pm
   
Why? This is a wrong approach to programming in strongly-typed languages.
—SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

There are any number of ways to do this. For example:
 
double d = 5.0;
bool isInt = d == (int)d;
You can also use modulo.
 
double d = 5.0;
bool isInt = d % 1 == 0;
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi,
 
you can use Math functions.
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web02 | 2.8.140926.1 | Last Updated 25 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100