Yes. Casting could cause you problems.
How big is the File?
"FileInfo.Length should be a Long and I was casting it to an Int....."
If greater than 2^31 - 1
then casting to an int
could be negative....
e.g.
long l = (long)Math.Pow(2, 31);
int i = (int) l;
Console.WriteLine("{0}", l);
Console.WriteLine("{0}", i);
Prints:
2147483648
-2147483648
Bottom line: FileInfo.Length
is a long
, so treat it as such.