Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is FileInfo.Length of type "long"?

I was just wondering whether anyone knows why the property FileInfo.Length is of type long instead of ulong? I don't think the size of a file can ever be negative.

Was this a general design decision for the .NET framework, since other length properties (e.g. string.Length) are also of type long?

like image 349
M4N Avatar asked Feb 23 '23 16:02

M4N


1 Answers

ulong isn't a CLS-compliant type. The framework tends to use CLS-compliant types where possible.

like image 116
Jon Skeet Avatar answered Mar 11 '23 08:03

Jon Skeet