Possible Duplicate:
How to determine if a decimal/double is an integer?
I have a variable of type double and am wanting to check whether it is an integer.
At the moment I have
public bool CheckIfInteger(double number)
{
return number.ToString().Contains(".") == false;
}
Is there a better way?
UPDATE: Sorry I didn't realise the potential for confusion, by integer I meant the mathematical definiton of integer, that is the natural numbers together with the negatives of the non-zero natural numbers.