Andrew,
No, you can not. It's like apples and oranges, you can't compare. You
have to convert one to the other before you compare.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
(E-Mail Removed)
"Andrew Murray" <(E-Mail Removed)> wrote in message
news:d14fke$1rk$(E-Mail Removed)...
> Is it possible to compare a double with a float in c# without casting to
> one of the types first?
>
> It appears you cannot...
>
>
> float num = 1.545f;
> double dnum = 1.545;
>
> if (dnum == num)
> {
> Console.WriteLine("You can");
> }
> else
> {
> Console.WriteLine("You cant");
> }